Can I hide the department field on the pre-chat form?

Return to top

17 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.

    Code:
    var _urlConfig = {
    'en-us': {
    departments: {
    enabled: ['']
    },
    locale: 'en-us'
    },
    '__default': {
      departments: {
    enabled: ['']
    },
    locale: 'en-us'
    };

    I also try to update enabled: ['']  to  enabled: [] or remove enable field. But it's not work at all.

    0
  • Thomas (internalnote.com)
    Community Moderator
    Zendesk Luminary

    The way to accomplish this is to define one default department in both the selected and enabled field:

    <!-- Start of Zendesk Widget script coded with https://widget.guide -->
    <script type="text/javascript">
    window.zESettings = {
       "webWidget": {
          "chat": {
             "departments": {
                "select": "hr",
                "enabled": ["hr"]
             }
          }
       }}
    </script>
    <!-- End of Zendesk Widget script -->

     

     

    0
  • Chinh Phan

    I tried.

    The button is not say "Chat" any more. It says "Help"

    0
  • Thomas (internalnote.com)
    Community Moderator
    Zendesk Luminary

    Make sure that the department you mention in the settings has

    1. Actually exists and is named identically in your Chat settings
    2. Has agents are available and online

     

    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 

    <script type="text/javascript">
    window.zESettings = {
    webWidget: {
    chat: {
    departments: {
    select: 'support',
    enabled: ['support']
    }
    }
    }
    };
    </script>
    <script type="text/javascript">
    window.zESettings = {
    webWidget: {
    chat: {
    departments: {
    select: 'sales',
    enabled: ['sales']
    }
    }
    }
    };
    </script>

    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)

    <script type="text/javascript">
    window.zESettings = {
    webWidget: {
    launcher: {
    badge: {
    layout: 'image_only'
    }
    }
    }
    };
    </script><script type="text/javascript">
    window.zESettings = {
    webWidget: {
    launcher: {
    badge: {
    image: 'support.jpg'
    }
    }
    }
    };
    </script>

    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
    Zendesk Employee

    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
    Zendesk Engineering
    Hi Jon,
     
    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
  • Thomas (internalnote.com)
    Community Moderator
    Zendesk Luminary

    Hey, you have no control over the webpage where this code loads, so you can’t use the custom widget code there. 
    Best practice is embedding the widget code on your website directly in the head or footer.

    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:

    <script type="text/javascript">
    window.zESettings = {
    webWidget: {
    chat: {
    departments: {
    "select": "hr",
    "enabled": ["hr"],
    }
    }
    }
    }
    </script>

    "hr" is shown in department but default value is "---":

    <script type="text/javascript">
    window.zESettings = {
    webWidget: {
    chat: {
    departments: {
    "enabled": ["hr"],
    }
    }
    }
    }
    </script>
    0
  • James G
    Zendesk Customer Care
    Hello Kayoko, 

    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 | Starszy Kierownik

    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
    Zendesk Customer Care
    Hi Edyta!
     
    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

Please sign in to leave a comment.

Powered by Zendesk