Solved

prefill custom fields for tickets

  • 13 January 2023
  • 2 replies
  • 538 views

Badge

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

icon

Best answer by Sudharshan 24 January 2023, 13:33

View original

2 replies

Userlevel 3
Badge +4

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!

 

Badge

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

Reply