Setting Priority field value based on customfield value

Please note that adding Javascript to custom fields is a customisation and not maintained as a supported part of JIRA.

Check the comments below. This page has been flagged as outdated.

As the users are neglecting the description of the Priority field, a more detail custom field is created to represent the Priority field. Depending on the radio button custom field selected, the Priority field value is set.

  1. Create a customfield name "Severity" at Browse >> Administration >> Issue Fields >> Custom Fields
  2. Configure the radio button custom field to have a field options
  3. Check the customfield ID in the Customfield table from the database by using the following SQL query:

    SELECT id FROM customfield WHERE cfname="Severity";
  4. Modify the following javascript code so that <id>will be replaced with the id of the custom field found from the first step:

    <script type="text/javascript" charset="utf-8" id="priorityCustomFieldScript">
        function setIssuePriorityAndSubmit(e)
            // set the value of the priority field here:
    		document.getElementById("priority").selectedIndex = 0;
    	else if(document.getElementById("customfield_<id>_2").checked)
    		document.getElementById("priority").selectedIndex = 1;
    	else if(document.getElementById("customfield_<id>_3").checked)
    		document.getElementById("priority").selectedIndex = 2;
    	else if(document.getElementById("customfield_<id>_4").checked)
    		document.getElementById("priority").selectedIndex = 3;
    	else if(document.getElementById("customfield_<id>_5").checked)
    		document.getElementById("priority").selectedIndex = 4;
        function hidePriorityAndAddSeverityHook()
    	var row = document.getElementById("priorityFieldArea"); = 'none';
        var currentLocation = window.location.href;
        if (currentLocation.indexOf('CreateIssue') > -1 || currentLocation.indexOf('EditIssue') > -1) {
  5. Paste the javascript into the description of the "Severity" customfield at Browse >> Administration >> Issue Fields >> Custom Fields.

There is no need to hide or remove the 'Priority' field from the screen. The javascript code will hide the Priority field by itself.

Was this helpful?

Thanks for your feedback!

Why was this unhelpful?

Have a question about this article?

See questions about this article

Powered by Confluence and Scroll Viewport