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 Sign up to answer
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Published 4 hours ago in Jira Software

How large do you think Jira Software can grow?

Hi Atlassian Community! My name is Shana, and I’m on the Jira Software team. One of the many reasons this Community exists is to connect you to others on similar product journeys or with comparabl...

69 views 4 4
Read article

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