-
-
Save akatz/1725201 to your computer and use it in GitHub Desktop.
Pre-fill custom fields in Zendesk
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
jQuery(function($) { | |
var customFieldParam = /^ticket\[fields\]\[(\d+)\]$/, | |
urlParams = $.queryParameters(), | |
k, match, fieldID; | |
// for each URL parameter: | |
for (k in urlParams) { | |
if (urlParams.hasOwnProperty(k)) { | |
// check whether it's a Zendesk custom field | |
match = k.match(customFieldParam); | |
if (match) { | |
// pull out the ID: | |
fieldID = match[1]; | |
// and set the value in the UI: | |
$('#ticket_fields_' + fieldID).val(urlParams[k]); | |
} | |
} | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment