How to use simple validator in scriptrunner?

Deleted user December 9, 2015

Hello

I wanna use a simple scripted validator using by scriptrunner plugin

So I tried to do below:

 

if(issue.resolution.name == "Fixed") {
cfValues['FIELD1)']?.values()*.value.size() == 1
cfValues['FIELD2']?.values()*.value.size() == 1
}
if(issue.resolution.name == "Postpone"){
cfValues['FIELD3']?.values()*.value.size() == 2
cfValues['FIELD4]?.values()*.value.size() == 2
}

 

However it was not working

I don't know how to use it..

 

please tell me how to use it 

 

thanks you ahead

1 answer

0 votes
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.
December 10, 2015

What do you want it to do?

At a guess I'm assuming you want that if resolution is Fixed you want a single option selected for those other fields. In which case you want something like:

if(issue.resolution.name == "Fixed") {
    return cfValues['FIELD1)']?.values().size() == 1 &&
        cfValues['FIELD2']?.values().size() == 1
}

if(issue.resolution.name == "Postpone"){
    return cfValues['FIELD3']?.values().size() == 2 && 
        cfValues['FIELD4']?.values().size() == 2
}

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events