Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Automation to Link Work Item using Variable

Eric Younkin June 25, 2025

I have an Automation that creates multiple new issues in sequence (Create Issue 1, branch: Edit. Create Issue 2, branch: Edit. Create Issue 3, branch: Edit.). I'm trying to get Issues 2, 3, and beyond to link to Issue 1 that is created in the automation. I've tried the built in Link work items for most recently created work item, but that does not work no matter where I put it.

Now, I am trying to create a Variable for the first Issue, and then Link to that Variable in issues 2, 3 and beyond. The audit log shows the variable is created, but then on the link step is showing "Unable to link work items. At least one of 'id' or 'key' is required to identify an issue", like it's not recognizing the created variable. 

Everything else in the automation is working perfectly. I've also tried Smart values for the variable of "{{issue.key}}" under the 'most recently created work item' branch of Issue 1, and that did not work.

Any idea how I can accomplish this, or what I'm doing wrong?

1.png2.png3.png

 

3 answers

1 accepted

1 vote
Answer accepted
Eric Younkin June 25, 2025

Thanks all- this got me thinking of limitations I hadn't thought of before. For those who may come across this in the future:

I ended up solving this by pulling the first Issue creation out of an IF branch so that it's in line with the original trigger, and assigning it a variable there. After that, I was able to put a final branch in line with the original trigger after all items were created, with the branch scoped to All linked work items: All link types (since they all linked to the Trigger issue), with an action to link to the variable. This allows all the branch created issues to see the original issue and link to it, while they are all linked to the Trigger issue with the Edit work item fields in their original branches. 

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.
June 25, 2025

Hi @Eric Younkin 

For more context, please post images of your complete rule (in a single continuous image) and of the complete audit log details showing one rule execution, with all of the areas expanded.  To show the rule in one image with high enough resolution, you may need to use a screen capture tool or browser addon with scrolling page capture.

Until we see those...

 

If your is using branching, the scope of the created variable may be preventing it from being "visible" to the other rule actions. 

Without seeing your entire rule, it is difficult to know if the rule can be built without any branching...such as by adding the links when the issues are created using the field Linked Issues rather than the separate action.

 

Kind regards,
Bill

Alex Kovell
Contributor
June 25, 2025

Bill's suggestion to use a single image can be easily implemented without the need for a screen capture tool or add-on in your browser. For example, if you're using Chrome on a Windows desktop; you can access this feature by opening Developer Tools, toggling the Device Toolbar, clicking on the Three Dot Menu, and selecting "Capture full size screenshot." Similarly, in Firefox on Windows, you can either navigate to the developer menu or use the shortcut Ctrl+Shift+S.

Like Eric Younkin likes this
0 votes
Mathew Lederman
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.
June 25, 2025

@Eric Younkin

I see two viable options:

  1. Add a 30-second delay and re-fetch after the creation of your first issue to your current automation rule.
  2. Break this up into two different automation rules. The first rule creates your initial issue. The second would be triggered off the first and could contain your branching logic. You could use {{triggerissue.key}} for your issue link and this should work 100% of the time because the second rule would only trigger once the creation of the first has completed. 

Sometimes you run into issues where the first issue is still in the process of being created when the rule gets to the branch logic and starts creating the second. Since the first issue doesn't fully exist yet, the link can't be succesfully implemented.

Eric Younkin June 25, 2025

Thank you for the suggestions, Mathew - A few issues:

1. We don't have Jira Premium, just Standard, so there is no "delay" action available in automations. That said, I think you are right in that the issue is with the branches being isolated, so not able to see Issue #1's variable.

2. I thought about that, but I am also assigning links to the Trigger issue (which is working perfectly) - if I broke creating Issues 2, 3, etc. into a separate automation, that would solve linking to Issue 1, but NOT to the Trigger issue, so it would introduce a new problem.

Mathew Lederman
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.
June 25, 2025

Do you have access to the "Related work items condition"? Could use that to link to the original trigger issue in the 2nd automation rule. 

Like Eric Younkin likes this

Suggest an answer

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

Atlassian Community Events