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 edited

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
atlassian, atlassian community, loom ai, atlassian loom ai, loom, atlassian ai, record recaps of meetings, meeting recaps, loom recaps, share meeting recaps,

Loom’s guide to great meetings 📹

Join us to learn how your team can stay fully engaged in meetings without worrying about writing everything down. Dive into Loom's newest feature, Loom AI for meetings, which automatically takes notes and tracks action items.

Register today!
AUG Leaders

Atlassian Community Events