Skip to main content
Solved

display ticket field to certain companies


acn084
Top Contributor
Forum|alt.badge.img+3
  • Top Contributor
  • 13 replies

with the help of this thread

 

I figured out how to hide an entire ticket field from all customer companies except customer 1. How do I go about only showing the ticket field for a few customers? like company 1 and company 6

 

Also this hides the drop down but does not hide the field label. Does anyone know how to remove the label as well?

 

<script type="text/javascript">
{% if portal.user.company_name <> "company 1"))  %}
  document.addEventListener("DOMContentLoaded", function() {
    		  jQuery('#helpdesk_ticket_custom_field_cf_affected_geo_3014498').remove();
      });
 {% endif %}
</script>

Best answer by acn084

updated the submit ticket portal and I was able to do this with a javascript case scripting. if company is c1,c2,c3 do nothing Else remove the custom drop down . I have not figured out how to hide the field label yet.

 

https://support.freshdesk.com/en/support/solutions/articles/65037-conditional-statements

 

<script type="text/javascript">
{% case portal.user.company_name %}
{% when 'C1' %}
{% when 'C2' %}
{% when 'C3' %}
{% else %}
    document.addEventListener("DOMContentLoaded", function() {
          jQuery('#helpdesk_ticket_custom_field_cf_affected_geo_3014498').remove();
    })
{% endcase %}
</script>

 

View original
Did this topic help you find an answer to your question?

3 replies

eeha0120
Skilled Expert
Forum|alt.badge.img+12
  • Skilled Expert
  • 746 replies
  • April 18, 2024

acn084
Top Contributor
Forum|alt.badge.img+3
  • Author
  • Top Contributor
  • 13 replies
  • Answer
  • April 25, 2024

updated the submit ticket portal and I was able to do this with a javascript case scripting. if company is c1,c2,c3 do nothing Else remove the custom drop down . I have not figured out how to hide the field label yet.

 

https://support.freshdesk.com/en/support/solutions/articles/65037-conditional-statements

 

<script type="text/javascript">
{% case portal.user.company_name %}
{% when 'C1' %}
{% when 'C2' %}
{% when 'C3' %}
{% else %}
    document.addEventListener("DOMContentLoaded", function() {
          jQuery('#helpdesk_ticket_custom_field_cf_affected_geo_3014498').remove();
    })
{% endcase %}
</script>

 


acn084
Top Contributor
Forum|alt.badge.img+3
  • Author
  • Top Contributor
  • 13 replies
  • May 23, 2024

The above code still kept the header but removed the field from the list. I’ve updated it to use the following and now it removes the entire form label from code. 

 

    document.addEventListener("DOMContentLoaded", function() {
        jQuery(document).ready(function($) {
        $('.form-label[for="helpdesk_ticket_custom_field_cf_affected_geo_3014498"]').closest('.form-group').remove();
    }); 


Reply