jira expression - comparing parent value in condition

dan_hersonsky March 19, 2024

Hi all

I want to make a condition that certain transition will be executable  only if one of the parent custom fields will match certain value.

For example - i have subtask which i want to move from : "in progress" to "done".

I want that this transition will be visible only where the field  org.group value which, belong to this subtask  parent, will be : SAP"

 

Best Regards

1 answer

0 votes
Floating electron March 19, 2024

Hi Dan, assuming that you have separate workflow for sub-tasks, it should be similar to:

issue.parent.customfield_xxxxx == "SAP"

 It depends what kind of field is your org.group field. If it is a Select, then it would be like:

issue.parent.customfield_xxxxx?.value == "SAP"

It's up to you to find out the id and type of your custom field. If you have an app with autocomplete feature like Workflow Building Blocks for Jira, in Jira expression field, after issue.parent. start typing the name of your field, you will get suggestions, which you can click and id of the field will be entered for you. You will also get syntax errors in case the type of the field is incorrect, which will help you make it right.

Finally, if you don't have a separate workflow, then you can make the condition to be checked only for subtasks, i.e. if parent != null. e.g.:

issue.parent != null ? issue.parent.customfield_xxxxx?.value == "SAP" : true

Hope it will help.

Cheers

 

dan_hersonsky March 21, 2024

Hi 

First thank you for your response.

Yes, i m talking about different WF.

eventually i implemented as you wrote  and added a small change.

It goes as follows : 

!! issue.parent.customfield_XXXXX && issue.parent.customfield_XXXXX.value == " SAP"

and it worked!!

 

 

 

Like Floating electron likes this
Floating electron March 21, 2024

I am glad, I could help :) 

Suggest an answer

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

Atlassian Community Events