Populate a field based on another field's content in Jira server

Still need help?

The Atlassian Community is here for you.

Ask the community

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

This article only applies to the Atlassian server platform. Learn more about the differences between cloud and server.

Purpose

JIRA currently has no way to display a field based on another field's selection. This article provides a workaround using javascript to accomplish this goal. For more information please refer to the linked JAC ticket:

JRA-41352 - Getting issue details... STATUS

Solution

If you would like show a Field B, ONLY if certain value from Field A is chosen, it can be achieved by performing the following steps:

  1. Create a "Free Text Field (unlimited text)" custom field type in the (Administration -> Issue Fields -> Custom Fields) page
  2. In this example, if a Priority - Critical (Field A) has been chosen for an issue, another field (Field B) will be displayed. Fill in the following text into the Description field (Field B):

    <script type="text/javascript">
      priority = document.getElementById('priority');
      if (priority) {
          target = document.getElementById('customfield_10000');
          // Hide the target field if priority isn't critical
          if (priority.value != 2) target.style.display='none';
     
          priority.onchange=function() {
              if (this.value == 2) {              
                         target.style.display = '';  
                         target.value="enter message here";
                      } else {
                     target.style.display='none';
              }
          }
      }
     </script>
    

    Make sure to change the customfield_ID and priority.value. To find the customfield_id, view the source of the page when viewing an issue, or check the URL when editing a custom field.

DescriptionJIRA currently has no way to display a field based on another field's selection. This article provides a workaround using javascript to accomplish this goal.
ProductJira
PlatformServer
Last modified on Sep 25, 2019

Was this helpful?

Yes
No
Provide feedback about this article
Powered by Confluence and Scroll Viewport.