Simple Scripted Validator: Require Due Date Reason if Due Date Selected

I've been mucking around with a Simple Scripted Validator (using ScriptRunner) for a while now. I clearly don't know what I'm doing. This is what I'm trying to do:

I have a Due Date Reason custom multi-line text field. I'd like it to be required only if the Due Date field has a selected value.

I'm using JIRA 7.3.1 and Adaptavist ScriptRunner 5.0.4.

1 answer

1 accepted

Accepted Answer
0 votes
Tarun Sapra Community Champion Jul 28, 2017

Try the following code (check the exact name of custom field)

if(issue.getDueDue()) {

  if(!cfValues['Due Date Reason'] ) {

    return false;

    }

}

return true;

This worked great! Thanks Tarun. I did have to fix one typo. I changed the first line to getDueDate.

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted Sep 18, 2018 in Jira

What modern development practices are at the heart of how your team delivers software?

Hey Community mates! Claire here from the Software Product Marketing team. We all know software development changes rapidly, and it's often tough to keep up. But from our research, we've found the h...

27,425 views 2 7
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you