Ricerche recenti


Nessuna ricerca recente

Automatically Populate Subject and Description Based on Drop-Down

Con risposta


Data ultimo post: 05 giu 2017

Utilizing a custom JS listener on the "New Request Page" I want to listen for my "custom field" and set the subject and description based on the selection.  I think I can access this based on the following code and a case or select statement; can anyone tell me if i'm on the correct path.

custom_field_75567587.addEventListener('change', function() { 

     switch (custom_field_75567587.value){
          case conference_room:
          $('.form-field.request_subject').hide(); // Hide subject
          $('.form-field.request_description').hide(); // Hide description
          $('#request_subject').val('Conference Room Setup'); // autofill subject
          $('#request_description').val('test description'); // autofill description
     }

});

 

 


0

31

31 commenti

Hey R. Bello,

I replied to your post here and added your question to our community roundup for August: Auto-populating fields in ticket forms with custom field input data

I also see you created a ticket for our Customer Advocacy team to look at. Someone from the appropriate team will reach out to you regarding your question :)

Cheers!

0


 We hide the Subject and Description and we're able to assign static values for them but we're trying something similar to what David has where the subject field is set upon the ticket submitted and populate the fields with actual data being submitted in the form. Here is the code we are using:

var ticketForm = location.search.split('ticket_form_id=')[1];

var subject_value = "New Email Request for " + $("request_custom_fields_1111111").val();

if(ticketForm == 2222222) {

$('#request_subject').val(subject_value);

$('#request_description').val(subject_value);

$('#request_subject').parent('.request_subject').hide();

$('#request_description').parent('.request_description').hide();

};


When I submit the form with that code, the subject and description just say "New Email Request for " and does not include the custom field data which is part of the form being submitted. I've tried different variations from what I've seen online to include single quotes, input# and even brackets and sometimes I get "New Email Request for undefined" or "New Email Request for [object Object]".

Any help in solving this is greatly appreciated. Thank you.

0


Hi William,

Answer-bot should look at both the Subject and Description of the ticket as mentioned in the following article: What part of a ticket does Answer Bot use to determine which articles to suggest?

If you're using custom code that may be affecting the results of answer-bot. I won't be able to assist myself but it may be helpful if you provide the code you're using so other members can take a look for you.

Thanks!

0


When the subject field is auto-filled, the answer bot not longer suggests articles based on key words, has anyone found a solution to this or a way to have the answer bot suggest articles based on the description rather than the subject? 

0


Hi David,

 

thanks for the input, im just learning this trial and error, I have never coded a thing before so this is like learning German in an afternoon 

 

I came across another post that changes the description value rather than hiding it, but it doesnt work when I tried to use the same code for the subject  I entered this using the field ID from my custom drop down where the bold text is 

 

$("#request_custom_fields_yournewfieldnumberhere").change(function() {
var newsubject = $(".request_custom_fields_yournewfieldnumberhere a").html();
$('#request_subject').val(newsubject);
});

it did not work, 

 

All I want to do is the following, - if someone could help me with the code exactly as I need to past it into the JS Tab

 

If a certain form is picked ( I have custom forms for each version of our product requiring support)

Then hide the subject from the form, and upon submission, use the value from the  custom drop down on that form to fill in the value for the subject so that the agent sees it

 

David, having used ZD for a while, your code to make the subject immediately fill with the new requester info is fantastic from an agent perspective, Kudos!

 

 

 

0


That's what we do in our zendesk. we hide the subject field and populate it at the point of submitting with values the user entered into other fields. This example creates a subject like "New User John Doe 2019-01-01"

So in addition to hiding the fields like Dan does, we add this code that sets the subject field upon submitting the ticket.

$("#new_request").submit(function(e){

//33860927 = FirstName
//33855548 = LastName
//33855528 = FirstDayOfWork

var subject_value = "New User " + $("#request_custom_fields_33860927").val() + " " + $("#request_custom_fields_33855548").val() + " " + $("#request_custom_fields_33855528").val();


$('#request_subject').val(subject_value);


});

0


Scratch that, I just need to hide the subject field and then auto fill it when its submitted with the value from a custom drop down field (in this case, the drop downs lists the common support topics for this specific form - for this form there are 8 'topics'  which are in essence, the subject anyway

 

So without having to add the specific code snippet for each possible variation, is there a way to grab the value and have it populate automatically, based on the value that the end user picks from the drop down?

0


Hi Dan

To hide and then autofill the subject with the name of the form, do you have to copy and paste that code you shared with the form ID for each form, or is there a way to do it so the name of any form picked from the initial form DD will get auto-filled to the subject line, that is the solution I am seeking

 

thanks

William

0


Thanks for sharing your solution, David!

0


I don't know if you ever got your answer for this, but this is something we did.

We hide the Subject field, and code similar to the following to set the Subject value when the user hit's submit on the request. Instead of the static value you see below, we actually populate the subject value variable by combining the values of several custom fields the user fills out on the form.

var subject_value = "Insert Subject Value Here";

$("#new_request").submit(function(e){

$('#request_subject').val(subject_value);

});

 

0


Il post è chiuso ai commenti.

Non hai trovato quello che cerchi?

Nuovo post