Question
Is it possible to completely hide the department field called Choose a department on the pre-chat form?
Answer
You can hide the department field from visitors by using the Departments API end-point with an empty array.
<script type="text/javascript"> window.zESettings = { webWidget: { chat: { departments: { enabled: [] } } } }; </script>
Simply add the above code after your widget script on your website. It will look something like this:
<script id="ze-snippet" src=[your widget key here]> </script>
<script type="text/javascript">
window.zESettings = {
webWidget: {
chat: {
departments: {
enabled: []
}
}
}
};
</script>
This code prevents any visitors from seeing the department dropdown and therefore from selecting a department. It does not remove the department functionality from the chat entirely. You can still assign a department to a chat request on the back end using a trigger or the departments.select function.
For more information, see the articles below:
22 Comments
Hi,
Is it possible to find the ID of a department so that we dont need to use the string of the name in our code? Sometimes we change the department name but want to ensure we dont need to update the code every time this happens.
I went to the chat dashboard and went to "Departments" and only saw the names of departments, but no IDs.
Any help would be great, as every article I click on seems to lead me to another article and another... :)
- Kristin
Hi Kristin,
If you have a standalone Chat account you should be able to get the department ID by first logging into your dashboard then navigating to zopim.com/api/v2/departments.
However, if you have an integrated Chat account with Support things get a little trickier here. You would need to use the following instructions to generate an OAuth token for your integrated Chat account so you can pull this information from the API: Chat API tutorial: Generating an OAuth token (integrated Chat accounts)
Hope this information helps!
Brett,
We are already using the API and we found what we were looking for with that, thank you for pointing me in the right direction! :)
Happy to help Kristin :)
Is it possible to remove a field? In our case, we would like to remove the phone number from one of our websites chat, but the form itself is a shared form, so we want to keep the field in place. If we cant remove it, can we hide it? Our attempts at using common jQuery or JavaScript methods are failing. Thanks!
Hello Kiva Bostrom,
We would also like to request the ability to remove the department field (and more generally, be able to customize this form to add other custom fields). After working with your support team, the code snippet is not working for us and we do not have engineering resources to tap into to investigate.
Hi I understand that the API solution will apply for the chat widged that customers see in external pages. How about changing the prechat form for the chat window in my Zendesk helpdesk?
How could I do that? Thanks for your help
Hello Andrew and Marcela Arango,
The only native functionality that removes the department dropdown from the pre-chat form is to turn off all your departments. Beyond that it does unfortunately require the use of API and custom coding.
The pre-chat form is quite hard coded and it is not possible to add custom fields either.
That being said, you can customize all of the fields and even have multiple forms available to visitors if you use the Web Widget. It's not a perfect solution of course because the Web Widget presents forms as a way to make a ticket, rather than before a chat is started.
Finally, Marcela Arango, if you're looking to use the API coding mentioned in this article in your Zendesk Guide Help Center instead of your own webpage, you can use these directions to help: How do I customize the Web Widget in my Help Center using APIs?
I'm sorry I don't have better solutions! I hope that helps a bit!
Thanks!
Hi,
Its clear how to do that with the API, but how does we do it when the web widget is available on the help center?
Hello Francois S
You actually can use the same API code to customize your Web Widget in your Guide Help Center as well. You'll simply put the code into your Help Center Theme as outlined in this article: How do I customize the Web Widget in my Help Center using APIs?
I hope that helps. Let me know if you have further questions on that!
Great! I managed to do it that way. Thanks!
i've run the code and it seems to do nothing. do I need to do anything else?
I've tested API access and can make tickets so when running
It's a two step process:
You need to set the enabled list to the one item and select one item:
wouldn't that just default to hr? we're trying to hide it entirely like this picture
https://support.zendesk.com/hc/en-us/articles/360022184994?page=1#comment_360004897033
and then have triggers on chat route to departments
Hello Team,
Closing the loop here. Brad and I were able to get this sorted out in a ticket. I've made updates to the article to be more clear on where to put the code (right in with your widget script that you've added to your website) and to be more clear that leaving it all blank does in fact make the Department dropdown completely disappear, not just uneditable.
I hope that all helps! Let us know if anyone has lingering questions.
Hi,
I read both these urls:
https://support.zendesk.com/hc/en-us/articles/115010352968
https://support.zendesk.com/hc/en-us/articles/360022184994?page=1#comment_360004897033
But it's still not work on my end.
I also try to update enabled: [''] to enabled: [] or remove enable field. But it's not work at all.
The way to accomplish this is to define one default department in both the selected and enabled field:
I tried.
The button is not say "Chat" any more. It says "Help"
Make sure that the department you mention in the settings has
Awesome, It hided.
Many thanks
Please sign in to leave a comment.