Missed Team ’24? Catch up on announcements here.

×
Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Validating two conditions in Simple Script Validator

Ray Lam
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
March 10, 2017

I am trying to validate that when an issue is type "Bug", whether Priority field is set to "None".

In the Script Runner simple scripted validator, if I put one of these conditions, they work as expected:

 

However, if I try to combine them, it doesn't work.

What is the correct syntax to combine them?

1 answer

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

0 votes
Niclas Sandstroem
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.
March 10, 2017

Did you try validating it as not null?

issue.priority?.name != null && issue.issueType.name == 'Bug'
Ray Lam
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
March 10, 2017

Thanks for the response Niclas. 

The Priority field in JIRA is a system field. It cannot be set to null. That is why we added a value called "None". Only custom fields can have a null value.

 

I was able to figure it out though. The validator needed to be:

issue.issueTypeObject.name != 'Bug' || (issue.issueTypeObject.name == 'Bug' && issue.priority?.name != 'None')
TAGS
AUG Leaders

Atlassian Community Events