This workaround is only necessary in select scenarios like if you want to use a form for Web Widget, but not in Help Center. Please reference Creating and applying branded ticket forms to find out how to selectively display different forms for different brands.
I've created multiple Help Centers for all of my brands, and now I'm ready to roll out ticket forms for each of the brands. But wait! I don't want my forms for my primary brand to show up on my Help Center for my secondary brand. Well this little trick is hopefully just the thing to fix that.
This article covers two scenarios:
Finding the form IDs
Whether you want to hide a form or single it out, for you to be able to target the individual forms, you have to first find the form IDs. This article will not cover creating forms. For more information on creating forms see, Creating ticket forms to support multiple request types .
Here is how you can find the IDs quickly in the agent interface:
-
In Admin Center,
click the Objects and rules icon
(
)
in the sidebar, then click Tickets > Forms.
- Click the name of the form you want to hide or use as your standalone form.
-
Take note of the form ID in the address bar as shown below:
- Repeat for each form you would like to hide or isolate.
Displaying multiple forms per brand
Often times each Help Center will manage multiple types of requests. This section will show you how to selectively hide any ticket forms you do not want to appear in a particular brand's Help Center, while still enabling the end-user to select the remaining forms.
The code
Now that we have recorded the ticket forms that we want to hide as described above , we can now target them with the code below.
Here is some code to be added at the very bottom of the footer.hbs template:
<script>
const formIdsToHide = [123, 456]; // change this array only with the IDs of the ticket forms to hide
formIdsToHide.forEach(formId = {
const option = document.querySelector('#request_issue_type_select option[value="' + formId + '"]');
if (option) option.remove();
});
</script>
Displaying one form per brand
Now you might be saying, "I only need one form for each brand." That's a perfectly acceptable workflow too! Instead of having to hide all of the extra brands, you could change your 'Submit a request' link to send users to one of your forms directly, and then hide the 'Please choose your issue below' dropdown list on the form.
The code
To send your users to one form, you will need your own form ID found in the steps above .
We can easily replace the 'Submit a request' link by using the Help Center templating language Curlybars. You can find some more Curlybars and templating documentation here .
You will want to place this code in the Header template where you want
the 'Submit a Request' link to appear (be sure to replace the
ticket_form_id
with your own). This does take localization
into consideration, so the link will be offered in the appropriate language if
you have multiple languages offered in your Help Center:
<a href="{{page_path 'new_request' ticket_form_id='17369'}}">{{t 'submit_a_request'}}</a>
Remove form selection dropdown from ticket form
Next, we want to remove the form selection dropdown from the ticket form, so
users don't select an alternate form for the current brand. You will want to
place this code in the style.css template of your Help Center:
.request_ticket_form_id{
display:none;
}
Enter the CSS in the style.css template.
How it Works
When the new request page is generated, all end-user facing ticket forms are made available in the dropdown list. The first example removes the form options which you do not want to appear for each specified brand and the second example simply directs users to one specific form for your brand.