Script validator to ensure if project = ABC, sprint field is NOT empty?

Tayyab Bashir
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
October 2, 2016

Hi, 
I'm making a simple script validator with Script-Runner on a workflow transition, and I want to ensure if project "ABC" or "DEF" is selected then the Sprint field should not be empty.

I can't find documentation on how to write something like this.
Could someone help me out with this? 
Thanks.
 

1 answer

1 accepted

1 vote
Answer accepted
JamieA
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
October 3, 2016
if (issue.projectObject.key in ["ABC", "DEF"]) {
    return cfValues["Sprint"]
}
else {
    return true
}
Tayyab Bashir
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
October 4, 2016

Exactly what I was looking for. 
Is there any detailed document for future references? So far i've seen just some particular examples.

 

Suggest an answer

Log in or Sign up to answer