We have the Jira plugin that consists of two multi-select custom controls: Clients and ClientContacts. Both controls are data-bound/populated at form load of CreateIssue and then once Contacts selection changes, data in ClientContacts is filtered based on the new value(s) in Contact. To achieve that all we need is for javascript (below) to be imbedded into jiraschema.fieldlayoutitem.Description filedof both custom controls . The functionality worked in Jira 5.0 , but is no longer supported in Jira 6.0 due to the security reasons.
https://jira.atlassian.com/browse/JRA-28776
Question: is there another/new field or configuration setting that will allow Javascript to execute/work same way as Description field in Jira 5.0? If not, what is the way to deliver the same functionality without extensive redesign of the plugin?
<script type="text/javascript"> AJS.$(document).ready(main()); function main() { var debug = false if(debug) { webBase = "http://localhost:2990/jira"; //webBase = "http://localhost:8080"; // Custom Fields client_customfield = "customfield_10000"; contact_customfield = "customfield_10001"; phone_customfield = "customfield_10002"; version_customfield = "customfield_10003"; } else { webBase = "https://jira.mapcom.com"; //webBase = "http://localhost:8080"; static_client_customfield = "customfield_10000"; // Custom Fields client_customfield = "customfield_10251"; contact_customfield = "customfield_10252"; phone_customfield = "customfield_10253"; version_customfield = "customfield_10237"; // Hide static Client custom field var oldContact = document.getElementById(static_client_customfield); if (typeof(element) != 'undefined') { oldContact.style.visibility = 'hidden'; findLableForControl(oldContact).innerHTML = ""; } } addContactListener("#" + contact_customfield,"change"); } function refresh() { var debug = false if(debug) { webBase = "http://localhost:2990/jira"; //webBase = "http://localhost:8080"; // Custom Fields client_customfield = "customfield_10000"; contact_customfield = "customfield_10001"; phone_customfield = "customfield_10002"; version_customfield = "customfield_10003"; } else { webBase = "https://jira.mapcom.com"; //webBase = "http://localhost:8080"; static_client_customfield = "customfield_10000"; // Custom Fields client_customfield = "customfield_10251"; contact_customfield = "customfield_10252"; phone_customfield = "customfield_10253"; version_customfield = "customfield_10237"; // Hide static Client custom field var oldContact = document.getElementById(static_client_customfield); if (typeof(element) != 'undefined') { oldContact.style.visibility = 'hidden'; findLableForControl(oldContact).innerHTML = ""; } } addContactListener("#" + contact_customfield,"change"); } refresh(); JIRA.bind(JIRA.Events.NEW_CONTENT_ADDED, function(e, context) { refresh();}); function findLableForControl(el) { var idVal = el.id; labels = document.getElementsByTagName('label'); for( var i = 0; i < labels.length; i++ ) { if (labels[i].htmlFor == idVal) return labels[i]; } } function addContactListener(field, event) { AJS.$(field).bind(event, function(e) { getPhoneBasedOnClientAndContact(field,event); }); } function getHTTPObject() { if (typeof XMLHttpRequest != 'undefined') { return new XMLHttpRequest(); } try { return new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { try { return new ActiveXObject("Microsoft.XMLHTTP"); } catch (e) { } } return false; } function populatePhoneNumber(http) { var phone = document.getElementById(phone_customfield); if (http.readyState == 4){ if(http.status == 200){ var number = http.responseXML.getElementsByTagName('value'); phone.value = number[0].firstChild.nodeValue; } } } function trim(s) { s = s.replace(/(^\s*)|(\s*$)/gi,""); s = s.replace(/[ ]{2,}/gi," "); s = s.replace(/\n /,"\n"); return s; } function getPhoneBasedOnClientAndContact(field,event) { var myContacts = document.getElementById(contact_customfield); var myClients = document.getElementById(client_customfield); var myPhone = document.getElementById(phone_customfield); var clientval = myClients.value var client_text = trim(myClients[myClients.selectedIndex].textContent) var contact_text = trim(myContacts[myContacts.selectedIndex].textContent) if(myContacts.value == "-1" || contact_text == "Not Available"){ myPhone.value = ""; return; } // If client was not first selected if(clientval == "-1"){ clientval = ""; } var path = webBase + "/rest/crm-rest/1.0/phone?key=" + escape(contact_text + " | " + client_text); var con = getHTTPObject(); con.open("GET", path, true); con.onreadystatechange = function() { populatePhoneNumber(con); } con.send(null); } </script>