using power script condition \ vaon Jira

Yuval Bar Lev July 7, 2024

on a workflow from status A to status B
I want to have RCA field as mandatory if labels contain "regression" and "stg"

on that workflow, I tried using power script as condition as used below jira expression 
then on the validator tab added validator that RCA field != empty (using 'Field Required Validator')

the problem:
1. RCA was always mandatory and didn't check the condition of certain labels
+
2. status B didn't appear on the statuses option list 

what did i do wrong?

issue.labels.contains("regression") && issue.labels.contains("staging")

 

1 answer

0 votes
Khang Bui_Candylio July 14, 2024

Hi @Yuval Bar Lev ,

From my POV, I think you should fix it as issue.labels.includes and use the workflow validator as here:

(issue.labels.includes("regression") || issue.labels.includes("stg")) ?

    issue.customfield_10423 != null :

    true

For status B doesn't appear on option list is maybe because you might have set up the workflow condition instead of validator.chrome_m7QjH3RXYG.pngchrome_58iBWtcoP3.png

I hope this can help and meet your requirement

Kind regards, 

Yuval Bar Lev July 14, 2024

thank you very much, very helpful @Khang Bui_Candylio  
1. so i should use only validator as you showed, and not have condition at all?
2. the below line you wrote, represent the RCA field that i want to make sure is not null? how do i know the field ID ('customfield_10423') for other fields?

3. if i want to have more then one field to validate is not null, i just add another row like the one below?

 issue.customfield_10423 != null :


Jira will force this validation only when the labels exist?

Khang Bui_Candylio July 14, 2024

Hi @Yuval Bar Lev ,

1. It's best practise to use validator if you want to validate fields and you will need a transtion screen from status A to status B

2. You can check customfield id by go to Settings > Issues > Custom fields > *Edit context* > You'll see a row of number on the URL

chrome_L7m7OjHfdO.png

3. It's best for you to use the product's documentation.

I hope this information is helpful

Kind regards,

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
STANDARD
TAGS
AUG Leaders

Atlassian Community Events