Enable 'Priority' options based on issue type

Enable 'Priority' options based on issue type

Goal

Enable and disable specific options for the field Priority based on the issue type.

Goal

Enable and disable specific options for the field Priority based on the issue type.

Scenario

You want to provide two different sets of values for the Priority field and make only one set of options visible based on the value for Issue type. For example, you want to use a specific set of values for Bugs, and another set for all other issue types.

Components

Script action

Baseline

  • If the issue type changes, the Priority value will not automatically be updated.

You are viewing the documentation for Jira Cloud.


Requirements

  • Jira Administrator login

  • Live Fields for Jira Cloud

  • Your instance must include values for the Priority field that only apply to specific issue types - for example, “Critical” is only available for Bugs.

Create the live fields configuration

  1. For Screens, select Issue create view, Issue view, and Issue transition view.

  2. Click Projects, and then click Select projects in the right-hand panel.

  3. Select the project or projects to which your configuration should be applied.

  4. Click Issue types, and then click Select issue types in the right-hand panel.

  5. Select the issue types to which your configuration should be applied (for example, Story and Task).

  6. Under THEN, click Add Scripted action, and then click Start scripting in the right-hand panel.

  7. Enter the following script:

useCase-PriorityOptionsIssueTypes.png
Figure 1 - Select issue types

 

// Enable or disable the "Priority" field based on the selected issue type /** * Fetch a priority by name. * @param {string} priorityName - The name of the priority to search for. * @returns {Promise<JiraApi.Priority | null>} */ const getPriority = async (priorityName: string): Promise<JiraApi.Priority | null> => { const priority = await JiraApi.IssuePrioritiesService.searchPriorities({ priorityName }); return priority.values[0] || null; }; // Get the current issue type const issueType = getFieldById("issuetype").getValue(); //Get the Priority values const criticalPriority = await getPriority("Critical"); const highestPriority = await getPriority("Highest"); const highPriority = await getPriority("High"); const mediumPriority = await getPriority("Medium"); const lowPriority = await getPriority("Low"); // Show the "Priority" field only if the issue type is "Bug" if (issueType?.name === "Bug") { getFieldById("priority").setOptionsVisibility([ criticalPriority.id, highPriority.id, mediumPriority.id], true); getFieldById("priority").setOptionsVisibility([highestPriority.id, lowPriority.id], false); } else { getFieldById("priority").setOptionsVisibility([criticalPriority.id], false); getFieldById("priority").setOptionsVisibility([ highestPriority.id, highPriority.id, mediumPriority.id, lowPriority.id], true); }
  1. Click Save.

  2. Check the box for On change to set the configuration to trigger only when the issue is updated.

  3. Click Save.

Enable and test your configuration

Your configuration is now complete. Verify that the configuration is enabled on the Live Fields administration page. Once it’s enabled, you can test it by creating a new Bug; verify that only the correct options are available for Priority. Then, create another new issue of any other issue type and verify the Priority values.

Congratulations!

You can now use different sets of options for a single select or multi-select field based on the value of another field!

useCase-PriorityOptionsScriptEditor.png
Figure 2 - Script editor

 

Need support? Create a request with our support team.

Copyright © 2005 - 2026 Appfire | All rights reserved.