How do I make a field required and shown only when a date has been passed?

Shounak Ghosh
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
March 6, 2018

I have a custom field called Due Date, which is a custom field in which a user inputs the date that they would like a Jira Issue to be resolved by. I also have a custom field called Why Was Due Date Missed, which is a multi line text entry field, which is hidden and not required by default. On the transition from the last workflow status to the resolution, I want the screen to force the user to enter something into the Why Was Due Date Missed Field before being able to transition the issue to a resolution status, if the current date is past the value of the Due Date field. What is the best/easiest way of doing this? Thanks in advance!

1 answer

0 votes
somethingblue
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
March 6, 2018

Hi Shounak,

You may need an add-on to fully accomplish this task, however, I would start with the knowledge base article How to display a Field based on another Field's selection and see if you can modify it for your needs:

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>
    

    (warning) 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.

Cheers,

Branden

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events