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

0 vote
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 Join to answer
Community showcase
Sarah Schuster
Posted Jan 29, 2018 in Jira

What are common themes you've seen across successful & failed Jira Software implementations?

Hey everyone! My name is Sarah Schuster, and I'm a Customer Success Manager in Atlassian specializing in Jira Software Cloud. Over the next few weeks I will be posting discussion topics (8 total) to ...

3,181 views 13 19
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
Atlassian Team Tour

Join us on the Team Tour

We're bringing product updates and pro tips on teamwork to ten cities around the world.

Save your spot