Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Branching on JQL linking issues excluding Trigger Issue

Andrea_Lawrence
Contributor
July 11, 2023

I have a parent issue that has 4 sub-tasks assigned to different people. I've created an automation using a manual trigger and I'm running it off of one of the sub-tasks.

Parent ticket is SEC-8590

Screenshot 2023-07-11 at 10.09.18 AM.png

I'm trying to accomplish the following:

  • create new issue in a different project
  • get specific list of issues
  • link each issue in list to created issue

The list of issues should be all open sub-tasks and the parent of the triggering issue. So if I run the automation from SUB-1 (SEC-8591), the lookup list should return 4 issues: SEC-8590 (parent), SEC-8591, SEC-8592, and SEC-8593.

Since I'm attempting to run from a sub-task, I am using the following query to get my list of issues:

(linkedIssue = {{issue.key}} {{#if(exists(issue.parent))}} OR linkedIssue = {{issue.parent.key}}{{/}}) AND status != "Done"

I attempted to follow the advice in the comments here but when I run the automation on a subtask, it's only linking 3 issues and excluding the trigger issue despite it being returned as a lookup result. Am I missing something?

I have the Lookup action with log as a results check which returns 4 issues but the JQL using the same query is only returning 3 issues and the trigger issue is missing.

 

Untitled 2.png

 

1 answer

1 accepted

2 votes
Answer accepted
Bill Sheboy
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 11, 2023

Hi @Andrea_Lawrence 

I believe that is the built-in behavior of rules to prevent potential errors/looping: the trigger issue is excluded from some branching scenarios.

A work-around is to add another branch to add that link explicitly.  This can be done in two possible directions, so pay attention to your link direction.  This could be...

  • branch: on current issue (which would be the trigger)
    • action: link to {{createdIssue.key}}

or...

  • branch: on most recently created issue
    • action: link to {{triggerIssue.key}}

I believe you can do the first one with a project-scope rule, and the second one would require a global/multi-project scope rule as you are creating an issue in a different project.

Kind regards,
Bill

Andrea_Lawrence
Contributor
July 14, 2023

@Bill Sheboy thank you for explaining, I wasn't aware that the trigger issue is skipped in branching actions. Since my end goal is to link everything to a new issue I'm creating, I modified my Create Issue action and added a link to the trigger issue. This way I didn't have to add anymore steps to my rule. Every test I've run since then has has been successful.

Thanks again for this information!

Like Bill Sheboy likes this

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events