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, jira service management, jsm webinar, ai in jsm, opsgenie integration, incident management, virtual agent, atlassian intelligence, ai-powered service desk, it operations, atlassian learning, service management webinar, team '25 recap

What’s new in Jira Service Management 🤔

Discover how Atlassian is revolutionizing service management with cutting-edge solutions for AI-powered support, HR Service Management, or DevOps connectivity.

Register here ⬇️
AUG Leaders

Atlassian Community Events