Forums

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

In Scriptrunner validator, How can I check if a custom field is null, THEN if not, check for the val

Cash Coyne
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.
January 25, 2024

I have this statement in a ScriptRunner validator for a workflow:

issue.customfield_11687.value != null && issue.customfield_11687.value=="Yes"

The problem is that if the value is null, it returns with an error:

Evaluation failed: "issue.customfield_11687.value" - Unrecognized property of `issue.customfield_11687`: "value" ('value'). Type null does not have any properties

Is there a way that I can check for a null value, and then if not null, check the actual value?

1 answer

0 votes
Kristian Walker _Adaptavist_
Community Champion
January 26, 2024

Hi Cash, 

I am assuming here that you are validating a select list field.

Instead of doing issue.customfield_11687.value != null you can just do issue.customfield_11687 != null to check if the field is empty.

The reason for this is the field will not have a value property set on it until it has a value entered into it.

I hope this helps.

Regards,

Kristian

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
PREMIUM
PERMISSIONS LEVEL
Product Admin
TAGS
AUG Leaders

Atlassian Community Events