Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Scriptrunner condition to require a comment when a custom field is a certain value

Andrea Hakim
Contributor
October 25, 2022

In a simple script validator, I have the following code:

(cfValues['Implementation Status']?.value == 'Rolled Back' && transientVars["comment"]) || !cfValues['Implementation Status']?.value == 'Rolled Back'

Expected Results:  Require a comment when Implementation Status = Rolled Back; otherwise don't require a comment.  Implementation Status is a Radio Button field

Actual Results:  A comment is always being required regardless of the value of Implementation Status.

 

1 answer

1 vote
Andrea Hakim
Contributor
October 25, 2022

Of course as soon as I post this, I realize I'm missing parenthesis:

(cfValues['Implementation Status']?.value == 'Rolled Back' && transientVars["comment"]) || !(cfValues['Implementation Status']?.value == 'Rolled Back')

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
SERVER
VERSION
8.20.1
TAGS
AUG Leaders

Atlassian Community Events