One of the projects I was working on this year had almost 100 different forms. Inside the content editor, I have them organized into subfolders under the Forms Item, something like the below image.
By default, you have the following three navigation items in the Forms application.
- All forms – List all forms you have in Sitecore
- My forms – List all forms created by the current user
- All templates – List all forms template you have in Sitecore
So when you open the Forms dashboard all the forms are listed together, as the All forms menu item are selected by default.
Of course, there is a search and filters to help you look for the form you want, but it would be nice to add more navigation items to group the forms the same way I have them in the Content Editor. So here is how I did it.
How it works
To add my own navigation items, it’s clear that I need to figure out how Sitecore did the ones shipped with the product.
Sitecore uses SPEAK for developing the applications in the Launchpad. I don’t have much experience in it. Still, I figured that since I’m not building something entirely new, let’s give it a try.
So let’s see what those navigation items are. I logged in to Sitecore and switched to the core database. After searching for the items of the form for a while I found that the navigation items are in the following path:
Those are simply items of type HyperlinkButton (
/sitecore/client/Business Component Library/version 2/Layouts/Renderings/Common/HyperlinkButton). Looking into the fields of these items, those are the ones that I’ll need to modify for the new items I’m adding.
|Text||Specifies the text inside the hyperlink|
|NavigateUrl||Gets or sets a URL this hyperlink points|
The three items navigate to the Forms page, but “My forms” and “All templates” items add a query string parameter
Searching for these ids shows that they are Search config items, you can find them here
It’s clear now that I’ll need to add my own search config items for the new menu items I want to add for the Sitecore forms folders I have. Checking those items, I found that they use a Solr query, so here are the fields I’m interested in.
Now it’s time to try out the solution
- Duplicate AllFormsSearchConfig (/sitecore/client/Applications/FormsBuilder/Pages/Forms/PageSettings/DataSource/AllFormsSearchConfig) Search config item with name Group 1.
- Change the DisplayText to Group 1
- Update the existing Solr query to filter forms based on parent id (the parent folder in content editor), the final query looks like this:
(is template:0) AND (_latestversion:1) AND (_parent:d3eb6997388b41fea1ddf6d09f0531e8) AND *
- Duplicate “All forms” (sitecore/client/Applications/FormsBuilder/Components/Navigation/Menu/Forms/All forms) navigation button with name Group 1
- Append the value of NavigationUrl with the following query string
?sc=The new Search Config ID created in step 1
Now it’s all set, let’s try it out. We need to switch back to the master database and check the Forms page.
And it worked!, I have new menu item that shows only subset of the forms.