Last active
August 29, 2015 14:21
-
-
Save skipjac/c3534964e4c4b0bd3d2f to your computer and use it in GitHub Desktop.
Set the default org 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
$(document).ready(function(){ | |
function setDefaultValue(field, setDefault){ | |
$('.'+field).one('DOMNodeInserted', function(d){ | |
var inputTar = $(d.currentTarget).children('select') | |
var inputNest = $(d.currentTarget).children('a.nesty-input'); | |
var TestObj = inputTar[0]; | |
var TestNest = inputNest[0]; | |
$('#'+TestObj.id).append('<option value="-">-</option>'); | |
$('#'+TestObj.id+' option').removeAttr('selected').filter('[value='+setDefault+']').attr('selected', true); | |
$(TestNest).text(setDefault); | |
}); | |
} | |
//build a JSON object with the ticket field ID as the key to the default tag value you want to set | |
var listOfDefaults = { 'request_organization_id' : '-'}; | |
for(var key in listOfDefaults){ | |
setDefaultValue(key, listOfDefaults[key]); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment