How can I hide ticket forms based on a user's organization?

Return to top

70 Comments

  • Morteza

    Is it possible to make the "dropdown menu" disappear and just show 1 ticket-form since there is only one to show? I mean I have multiple ticket-forms but they are all hidden and only shown for one specific organization. As shown in the picture below, there is only one ticket-form but still it is in a dropdown menu together with a dash sign (-). 

    Is it possible to just show the ticket-form and skip the dropdown menu. I've come this far by simply following the instruction above for hiding ticket-forms.

     

    0
  • Gabriel Manlapig
    Zendesk Customer Care

    Hi Morteza,
     
    I found this community post that provides insight on how to hide a ticket form selector. 
     
    https://support.zendesk.com/hc/en-us/community/posts/4409515399066-How-to-disable-the-ticket-form-dropdown
     
    Please note that the suggestions mentioned in the community post was not created by Zendesk. If you have any questions or issues, please reach out to the post above for further assistance. Thank you!

    0
  • Morteza

    Hi Gabriel Manlapig, thank you for your help but I would like to hide the dropdown menu in general and not after selecting a form. 

    So, lets say that there are 3 forms A, B and C. And 3 different companies company1, company2 and company3.

    The forms are customized in a way that form A is only shown to company1, form B is only shown to company B and form C is shown to company3. The problem is that when you click on submit, there is still a dropdown menu, when you want different companies to land on their own forms directly and not get a dropdown menu despite having one form to show.

     

    1
  • Ulises Soto

    Hi,

    I am looking to hide certain custom ticket field dropdown options and some ticket fields based on the form selected, how could I do that?

    0
  • Brittany Mandel

    I'm getting a "$ is not defined" error when following these instructions.

    0
  • Ben Ellis

    Hey there, I reviewed the comments and couldn't understand whether there is a simple solution to having separate forms for different organizations. In a nutshell, we would like our internal users (Org A) to submit tickets using a designated internal form, while all our customers (external) use a different form. Any help from the great Zendesk community? 

    1
  • Jupete Manitas
    Zendesk Customer Care
    Hi Ben, thanks for writing in! Natively, separating your form based on the organization is not available but as per this advice, you can separate it through customization by editing your Javascript code. You may need your developer's assistance to accomplish this. However, if your internal users are your agents, you can possibly try to create an internal help center and internal users can submit a request from there. Does creating an internal help center would suffice as a workaround? You can check this if you haven't checked it yet: Best practices for creating an internal knowledge base 
     
    Thank you!
    0
  • Administration Account

    Hi, maybe somebody has a solution how to hide ticket forms based on user segment? 

    The logic of the hiding is pretty much clear. I cannot find a solution how to pull user segment and use it in the code. 

    0
  • Max

    Hello there,

    So I have been able to make it work with the help of our best coding buddy, chatGPT. I am sharing here the way I've done it for rookies like me.

    1- Importing jQuery library

    Copy/paste the following script in document_heads.hbs template

    <script src="https://code.jquery.com/jquery-3.6.0.min.js" integrity="sha256-/xUj+3OJU5yExlq6GSYGSHk7tPXikynS7ogEvDej/m4=" crossorigin="anonymous"></script>

    2- Edit the JavaScript

    Copy/paste the code in script.js

    The behaviour expected on my side is described as follows, but it can work for more forms and/or more organizations.

    I have 2 forms, named here formIDexternal and formIDinternal.

    Some organisations defined as orgsInternal have to see one form, the formIDinternal
    The rest of organizations, defined as orgsExternal has to see the other form, formIDexternal

    In the variables section (var) define and list your forms and your organizations.

    In my case I want Org1, Org2 and Org3 to only be able to see form id 987654321 .

    Then add your if statements. It should work without any problem !

    $(document).ready(function() {
       var formIDexternal = 123456789; // Change this to the form ID you wish to remove (external)
       var formIDinternal = 987654321 // Change this to the form ID you wish to remove (internal)
       var orgsInternal = ["Org1", "Org2", "Org3"]; //Type here your organizations name
       var orgsExternal = ["Org4", "Org5", "Org6"]; //Type here your organizations name
       var userOrgs = window.HelpCenter.user.organizations;
       var userOrgNames = userOrgs.map(org => org.name);

    if (userOrgNames.some(orgName => orgsInternal.includes(orgName))) {

          // If the user belongs to one of the organization Internal specified, remove the form option from the dropdown
          $('#request_issue_type_select option[value="' + formIDexternal + '"]').remove();
          $('.nesty-panel').on('DOMNodeInserted', function(e) {
            $(this).children('ul').children().remove('#' + formIDexternal);
          });
        }
      
    if (userOrgNames.some(orgName => orgsExternal.includes(orgName))) {
          // If the user belongs to one of the organization External specified, remove the form option from the dropdown
          $('#request_issue_type_select option[value="' + formIDinternal + '"]').remove();
          $('.nesty-panel').on('DOMNodeInserted', function(e) {
            $(this).children('ul').children().remove('#' + formIDinternal);
          });
        }
      });

    1
  • Mark Rickard

    ChatGPT suggests the following should work for a logged-in user of org 'ORG1' but how does it know you're talking about request form IDs?

    //Hide forms from ORG1 users

      jQuery(document).ready(function() {
      if (HelpCenter.user) {
        var isORG1Member = HelpCenter.user.organizations.some(function(org) {
          return org.name === "ORG1";
        });

        if (isORG1Member) {
          $("#17932684959515").hide();
          $("#17932846343067").hide();
          $("#13528765623707").hide();
        }
      }
    });

    0

Please sign in to leave a comment.

Powered by Zendesk