Populating Custom Fields in the Help Widget
If you are using the help widget, and you want to pre-populate the ticket fields, Zendesk gives you the ability to pre-populate name and email only (see https://developer.zendesk.com/embeddables/docs/widget/api), but if you have custom fields that you want to pre-populate, this can be tricky.
Here's how I managed to do it:
$(document).ready(function(){
setTimeout(function() {
$('iframe#ticketSubmissionForm').contents().find('input[name=####]').val('Foo');
}, 10000);
});
This will:
- wait for the DOM to finish loading
- then wait 10 full seconds to allow the widget to asynchronously load
- then find the widget iframe, search it's contents for an input field with name #### (should be a long number specific to your field - use the browser inspector to see what your number is)
- add text 'Foo' to that field
Hope this is helpful to someone!
-
Hey Greg!
Thanks for sharing this tip! I'm going to go ahead and move this over to its rightful home in the Tips & Tricks section. :)
-
Great tip! Thanks, Greg.
Post ist für Kommentare geschlossen.
2 Kommentare