Auto-populating fields in ticket forms with custom field input data

5 コメント

  • Brett Bowser
    Zendesk Community Team

    Hey R. Bello,

    While I can't assist with custom code on my end, I did want to share some documentation we have available that may help point you in the right direction:

    I'll also get this post added to our Community Roundup for August to help provide visibility to other users who may be able to offer up some guidance. 


  • Thomas Verschoren
    Community Moderator


    In short I think you should change $("request_custom_fields_1111111").val(); to $("#request_custom_fields_1111111").val();

    But this only takes the field value upon submit, which may throw errors if fields are required.


    Other solution: set the field upon dropdown change.

    I did this recently for a client of ours: When they select a dropdown, we set the subject field based on the choice.

    Although the field is visible, the concept is the same. 


    In your case it would be something akin to:

    //Set form subject based on dropdown
    $(document).on("change", "#request_custom_fields_360000077818", function() {
  • R. Bello

    Zendesk Support provided a link to this post:

    and I was able to find the right code for it. It wasn't coded under $(document).ready(function(), it had to include a submit function, see below:


    $(document).submit(function() {

    var subjectstring1 = $("#request_custom_fields_1111111111").val();

    if (window.location.href == ""){
    $('#request_subject').val("New Email" + " - " + subjectstring1);


  • Daniel Renwick

    Can you remove subject and body/description for a single brand among several?

  • Kay
    Community Moderator

    Hi Daniel,

    In the request form you could do that yes.
    Something like

    if (window.location.href.indexOf("BRAND URL HERE") > -1) {
    document.querySelector('.request_subject').style.display = "none";
    document.querySelector('.request_description').style.display = "none";

    document.querySelector('.request_description').style.display = "none";



Powered by Zendesk