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

Automatically Link Tickets Generated from Scheduler

Dan Schetley
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
October 31, 2023

Hello,

 

I'm hoping we're just over thinking this, and there's an easy answer, but we currently have 60+ JIRA stories in a Kanban project created by the Scheduler on the first of each month.  What we're trying to do is migrate those stories to the Scheduler in a JIRA Work Management board and automatically link them through an Automation since the tickets have dependencies on each other (can be one to one, or one to many dependencies).  This way the progression will show up in the Timeline tab of JIRA Work Management.  Below are examples of the ticket structure:

- Ticket A is dependent on B being completed and A should be blocked by B

- Ticket D is dependent on B and C being completed and D should be blocked by B and C

The goal is to try to avoid someone needing to manually go in and link the tickets in the JIRA Work Management board.

1 answer

0 votes
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.
October 31, 2023

Hi @Dan Schetley 

Regardless of the way the issues are created, an automation rule would need guidance for the linking.

If you are creating these with a scheduled trigger automation rule, the linking could probably occur there, either through absolute (e.g., a specific key and link type) or relative linking (e.g., link to the last issue created in the rule).

Kind regards,
Bill

Joe Tobey November 3, 2023

@Bill Sheboy I was working to help @Dan Schetley with this and I was getting stuck on the relative linking related to the "last issue created".  It kept trying to reference itself.  For example:

Automation Creates Issue1 then Issue2.  When I use the relative linking, it sees Issue2 as the "Last Issue Created" and errors out as it cannot reference itself.  any thoughts for getting around that?

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.
November 3, 2023

Hi @Joe Tobey 

There are a couple of solutions for that...

First, as issues are created in the main execution path of the rule, two smart values are available: {{createdIssue}} and {{createdIssues}} (note the plural).  With the second one any of the previously created issues could be referenced using the get() function in the list, with {{createdIssues.get(n)}} where n is a 0-based index for the issues.  And so the first one is 0, and the key is {{createdIssues.get(0).key}}

That method breaks down if the issues are created either inside of an if/else structure or a branch, due to scoping issues. (There is sometimes a work-around for that, using the method below.)

 

The second method is to save the {{createdIssue.key}} with the Create Variable action after the issue is created.  This method is often used when cloning a tree of issues, like the epic and its children.

Kind regards,
Bill

Like # people like this
Dan Schetley
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
November 3, 2023

Hi @Bill Sheboy ,

Thanks for the quick responses.  Would it be possible to send an example automation for my example above:

Ticket D is dependent on B and C being completed and D should be blocked by B and C

I think if we could get that then we can build upon it from there.

Thanks,

Dan

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.
November 3, 2023

The only tricky part about a rule like this is setting the issue links: when you type in the smart value, it appears below the field, and then it can be selected for use to link the issues.

Here's an example rule.  The links must be added one at a time, due to limitations in the rule actions (and supporting REST API functions).

  • trigger: manual
  • action: create issue-B
  • action: create issue-C
  • action: create issue-D
    • select the Linked Issues field, and enter the following to link to issue-B
      • is blocked by
      • {{createdIssues.get(0).key}}
  • branch: to most recently created issue, which is D
    • action: edit issue, select the Linked Issues field, and enter the following to link to issue-C
      • is blocked by
      • {{createdIssues.get(1).key}}

Please try that first to confirm it works as you expect, and then expand for the remainder of your scenario.

Like # people like this
Joe Tobey November 13, 2023

This works great with some slight modification.

Like Bill Sheboy likes this
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.
November 14, 2023

I am glad to learn that helped.  Please consider marking this question as "answered", as that will help others in the community with similar needs find solutions faster.  Thanks!

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events