Skip to main content
Solved

prefill custom fields for tickets

  • Jan 13, 2023 10:14 AM UTC
  • 2 replies
  • 1607 views

Forum|alt.badge.img

Hi,

I’ve created some custom fields for my ticket forms. I want to prefill some of these forms with generic informations but I can’t find how.

 

Is it even possible ?

thanks

Best answer by Sudharshan

Hi @JulienM,

 

Greetings from Freshdesk community!

 

I understand you'd like to prefill the ticket form on your customer portal. I'd like to point out that this can be achieved by using the portal customization at your end. You might have to reach out to your developers to achieve this.

 

Having said that, I'm sharing a sample code with a use case where we auto-populate/modify a field in the form based on a dropdown field.

 

Below is a sample code that will be helpful for you to customize the ticket form, which auto-populates certain fields. Please use it  Admin>Support Channels>Portals>Customize Portal>Layout & Pages>Portal pages>New ticket 

 

<script>var field_to_check = '#helpdesk_ticket_product_id';var field_to_change = '#helpdesk_ticket_subject';jQuery(field_to_check).change(function() {    var check_value = jQuery(field_to_check).val();    console.log(check_value);    if (check_value == 67000000832) {        jQuery(field_to_change).val("Smartel Restaurat - ");    } else if (check_value == 67000000833) {        jQuery(field_to_change).val("Test Product - ");    }});</script>JavaScript

 

Note:

 

1. In the first line, you must change the field_to_check with the field ID you want to check. In the next line, you have to change the field_to_change with the field ID where you want to auto-insert the text

 

Note that this is a sample code. However, please reach out to your developer team for assistance for your use case.

 

Cheers!

 

View original

2 replies

Sudharshan
Community Debut
Forum|alt.badge.img+5
  • Community Debut
  • Answer
  • Jan 24, 2023 12:33 PM UTC

Hi @JulienM,

 

Greetings from Freshdesk community!

 

I understand you'd like to prefill the ticket form on your customer portal. I'd like to point out that this can be achieved by using the portal customization at your end. You might have to reach out to your developers to achieve this.

 

Having said that, I'm sharing a sample code with a use case where we auto-populate/modify a field in the form based on a dropdown field.

 

Below is a sample code that will be helpful for you to customize the ticket form, which auto-populates certain fields. Please use it  Admin>Support Channels>Portals>Customize Portal>Layout & Pages>Portal pages>New ticket 

 

<script>var field_to_check = '#helpdesk_ticket_product_id';var field_to_change = '#helpdesk_ticket_subject';jQuery(field_to_check).change(function() {    var check_value = jQuery(field_to_check).val();    console.log(check_value);    if (check_value == 67000000832) {        jQuery(field_to_change).val("Smartel Restaurat - ");    } else if (check_value == 67000000833) {        jQuery(field_to_change).val("Test Product - ");    }});</script>JavaScript

 

Note:

 

1. In the first line, you must change the field_to_check with the field ID you want to check. In the next line, you have to change the field_to_change with the field ID where you want to auto-insert the text

 

Note that this is a sample code. However, please reach out to your developer team for assistance for your use case.

 

Cheers!

 


Forum|alt.badge.img
  • Author
  • Apprentice
  • Jan 27, 2023 10:41 AM UTC

Hi. thanks for your answer. It helped me a lot.