Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,370,157
Community Members
 
Community Events
168
Community Groups

Using Advanced Branching to iterate over a list of issues and performing an action on each issue.

I recently read the following article: https://community.atlassian.com/t5/Automation-articles/Branching-over-smart-values-in-Jira-Automation/ba-p/1741935

This article mentions "Iterating over a list, such as a list of issues from Lookup Issues action, and performing an action on each of these issues"

I am trying to use the "Advanced Branching" action in order to update the summary of a list of issues, based on a customfield value in each of those issues.

Atlassian.PNG

The result of the above automation is not that each issue in the LookUp is edited.

The Issue that I am triggering this off is having its summary edited.

 

My desired outcome is that I provide a list of issues. For each of these issues I would like to pass out a customfield value on the issue (not included in the above automation to make it simpler) to the summary.

 

1 answer

0 votes

Hi @Shaun Dunstan and welcome to the community,

Could you please also provide a screenshot of your audit log and of your create variable action? that would give some more information.

Furthermore: Did you check the result of your lookupIssues? Does it return the expected list of issues?

Best
Stefan

Stefan Salzl Community Leader Aug 25, 2022

Furthermore:
As you would like to iterate over the list of issues and edit each of them: Is there a special reason to avoid using a JQL branch?

See the following screenshot:
image.png

eg. I do have "ISSUE-A", this issue has 3 other issues linked with "relates to" (ISSUE-B, ISSUE-C, ISSUE-D).
After the execution of the rule only the 3 linked issues (B-D) are editted.

Isn´t this the result you expected or did I miss any information?

Best
Stefan

Hi @Stefan Salzl ,

Thanks for your response. I have been able to verify that my LookUpIssues is returning the correct issues.  In our current example it is intentionally only returning 1 issue.

Audit Log:

Audit Log.PNG

Variable:

Variable.PNG

Regarding JQL branching: It is my experience that when using a JQL branch, the value that is used to modify the list of issues is based off the trigger issue, not each issue itself.

ie:

JQL Branch from Issue A.
Issue A has a summary of "X"
Issue B has a summary of "Y"
I want to update the description of each issue to each issues summary.
Issue A will place value "X" into the description.
Issue B will place value "X" into the description.

In my requirements, I need the value to be specific to each issue.

I hope my example has provided clarity.

Neil Ashford Atlassian Team Sep 04, 2022

Hi @Shaun Dunstan,

As long as your action is inside the branch, smart values like {{issue.summary}} should refer to the summary of the issue you're looping over, instead of the trigger issue. To access the summary of the trigger issue within a branch, use {{triggerIssue.summary}}.

 

I found this in the docs, I hope it helps:

Smart-values in components defined for related issues will refer to the related issue by default. That is {{reporter.displayName}} will refer to the reporter of the sub-task (when looping over sub-tasks). You can however also access the issue that triggered this automation rule via {{triggerIssue}} (e.g. {{triggerIssue.fields.summary}}).

 

— Neil

Like Stefan Salzl likes this
Stefan Salzl Community Leader Sep 05, 2022

Hi @Shaun Dunstan 

As far as I understand your requirement Issue A is the triggerIssue. This only says it triggers the rule and the key is stored in the smart value triggerIssue. This does not need to be part of the result of your JQL. Within your rule a JQL branch can execute ANY JQL which means the result could be any other issue key (or a list of issues).

futhermore as your described:

Issue A already hast "summary X". So this issue would not need to be changed anyways. You just would like to have issue B the same summary as issue A so no need to edit issue A.

Please correct me if I´m wrong.

Best
Stefan

Suggest an answer

Log in or Sign up to answer