Make cf (checkboxes) required if resolution field equals value.

Serj Shcherbakov November 12, 2015

Hi!
I make script, but resolution validation is not working.

JIRA:
6.4.5

Adaptavist ScriptRunner for JIRA Standard Edition:

3.1.4


How can i fix it?
Maybe someone know where is mistake? 

There is my code:

issue.resolutionObject.name == 'Training Delivered' || cfValues['GP Code checked']

Hope you help me.

i need make field ['GP Code checked'] required if resolution = 'Training Delivered' 

3 answers

1 accepted

2 votes
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.
November 12, 2015

It should be:

issue.resolutionObject.name != 'Training Delivered' || cfValues['GP Code checked']

Which means, if it IS traning delivered, that checkbox must have a value. It;s kind of inverted... lots of examples here: https://scriptrunner.adaptavist.com/latest/jira/recipes/workflow/validators/simple-scripted-validators.html

You can write it long-hand if it's clearer:

if (issue.resolutionObject.name == 'Training Delivered') {
    return cfValues['GP Code checked']
}
else {
    return true
}

 

 

 

0 votes
Shcherbakov Sergey November 12, 2015

Damn cannot added more then 3 comments.... i need make field ['GP Code checked'] required if resolution = 'Training Delivered'

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.
November 12, 2015

Can you describe what you want to achieve.

Suggest an answer

Log in or Sign up to answer