Forums

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

ScriptRunner Workflow Validators to check component is set to specific value

Rees, Ian
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.
July 15, 2025

I am trying to create a Scriptrunner Validator to prevent the transition of an issue if the component field does not have the value "Red" or "Blue".

I can check that there is at least one component using

issue.components.length > 0 but I can't get a check on the name correct

I've tried lots of different syntax around checking i

issue.components.includes("Red")

but I can't seem to get this right. Can anybody help please ?

2 answers

Suggest an answer

Log in or Sign up to answer
0 votes
Maciej Dudziak _Forgappify_
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.
July 28, 2025

Hi @Rees, Ian

To answer your question, let me introduce the Ultimate Validator — a feature we developed as part of the Workflow Building Blocks for Jira app. It was designed to simplify working with Jira Expressions.

The built-in Jira Expression Preview helps you understand how each expression is constructed.
Since you're already using an app that supports Jira Expression-based validators, you can simply copy the generated expression and use it in the tool of your choice.

Here is how it looks:
Community_28.07.2025_components.png

I hope it will help,
Cheers

0 votes
Stefan Salzl
Community Champion
July 21, 2025

Hi @Rees, Ian 

did you try to log the result of issue.components?

I could imagine that the result is an object and the attribute is ‚name‘. 

So I would suggest the following steps:

  • log „issue.components“
  • log „issue.components.name“
  • if „issue.components.name“ returns a String or an array/list of strings .cotains or .includes should do the job

 

Please let us know if this helps.

Best
Stefan

DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
PREMIUM
TAGS
AUG Leaders

Atlassian Community Events