Question
Is it possible to completely hide the department field called Choose a department on the pre-chat form?
Answer
There is no native setting that will remove the department field entirely. In your pre-chat form settings, unchecking Require Department doesn't remove the field from the pre-chat form but it will make it optional.
However, 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 this article: Automatically route chats to departments.
14 comments
Chinh Phan
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.
0
Chinh Phan
I tried.
The button is not say "Chat" any more. It says "Help"
0
Chinh Phan
Awesome, It hided.
Many thanks
0
Davide Gerevini cc
Hi there
We have two separate widgets each managed by a specific department (lets say Sales and Support).
Following the guidelines above I was able to hide the department field on the pre-chat form of both widgets and set departments selection
Problem is that now the widgets show the offline form (with its welcome message) only when all the agents are offline.
For example If some of Sales agents are online and all Support agents are offline, both widgets show the pre-chat module and on the Support widget it sends an email once compiled instead of starting the chat (as expected but no explanation in the form). I would rather expect that the widget whose agents are offline would show the offline form.
Moreover if I also add a script to load a custom badge image on one of the two widgets (the other one uses the image specified in the Chat setup)
the previous setup seems to be ignored, and the drop down menu for choosing the department appears again.
Any help will be appreciated, thank you!
0
Adrian Joseph Magboo
Hi Davide,
Good day! It looks like you've assigned a department to each of your widgets and you would like to set the widget status depending on the status of the department assigned.
If this is the case, you can use the API script mentioned here Can I configure the Web Widget to present Chat on my webpage only when a specific department is online?
I hope this helps.
Regards,
Adrian
0
Davide Gerevini cc
Hey Adrian
This worked beautifully, thank you! I totally missed that script.
Thanks again,
Davide
0
Jon Gallez
Are there plans to have the widget remember or automatically collect data from existing users?
0
Dane
Authenticated users have all the data of the their current profiles. This can automatically be done if your Help Center will require users to sign in.
Another option is to use Enabling authenticated visitors in the Chat widget.
0
Steven Hampson
Hi, I used the above code and it worked fine on our Help Center. However, we are using a link to Chat on our website, instead of the widget, and department still shows when clicking the link.
I urgently need to get this hidden. How can I update it so that it will no show department from the link either please. The link we are using is:
https://static.zdassets.com/web_widget/latest/liveChat.html?v=10#key=subdomain.zendesk.com
Thanks,
Steven.
0
Steven Hampson
Thomas (internalnote.com) Thanks for clarifying!
0
Kayoko HAYASHI
Hi, I try to filter the departments in widgets.
But department is not shown if both the selected and enabled propety set.
When function sets either fields, department is shown.
The following code does not work:
"hr" is shown in department but default value is "---":
0
James G
Yes, this is expected behavior. When there's only one option for a department and it is already selected, then the chat department field becomes hidden since the visitors won't be able to interact with it. Also, the department is automatically set in this kind of configuration so in your case, the chat department "hr" is automatically set.
0
Edyta Tudek
I have a problem with script for hiding departments. Sometimes departments in the pre-chat form are visible. I can't figure out why... Any ideas?
0
Mike DR
There could be a code on your website that's conflicting with the widget script, you can try testing your widget and hide departments script on jsfiddle.net to see if the issue will still occur. If it doesn't happen there, your dev team could check out which code on the website is conflicting with the Zendesk code.
1