Forums

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

Automation Linking Multiple Issues To Each Other via a Custom Field?

Derek LoGrande January 30, 2025

I can't figure out a proper for-each loop that will both run automation for the trigger issues, and each of the destination issues that are linked so every related issue is consistently linked to each other.

Scenario: account1, account2, and account3 all related to each other via a parent account number and need to be linked. So far, I only have been able to create automation that links account1 to account 2 and account3 using a for-each loop to see all issues in a project that have the same parent account number and link it to the trigger issue when the parent account number is populated in a newly created issue.

My current automation's output:

account1 relates to account2 & account3

account2 relates to account1 (missing link to account3)

account3 relates to account1 (missing link to account2)

 

How do I use Jira automation to solve for the missing links in account2 & account3? A secondary automation that triggers when the trigger issue becomes linked?

Below is the current automation:

image.png

 

Thanks!

 

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.
January 30, 2025

Hi @Derek LoGrande -- Welcome to the Atlassian Community!

Such scenarios are challenging, risky, and brittle to manage with Jira and automation rules.  Please consider:

  • Edge cases (e.g., what to do when a Main Account Number is changed such as from an entry error)
  • Cross-linking errors (e.g., A -> B -> C -> A) causing endless looping
  • A rule error (or automation outage) partially links the issues, forcing manual issue edits for recovery
  • etc.

When one wants to do such linking, there are often better solutions by selecting one direction for the links, or using a common field value for identification (e.g., a single-select option field choice with the same value in all issues).

 

Regardless of that information, consider using two rules: one to "flag" an issue's links should be updated to a list of issues (stored in custom field), and a second rule detecting the "flag" to perform the linking and clear the flag.

 

Kind regards,
Bill

Derek LoGrande January 30, 2025

Hi Bill,

Good call out, however, the Main Account Number is set via automation when a request is received. The upstream source validates the Main Account Number so there should not be any chance of error.

There are a lot of accounts and it would be cumbersome to manually have users link the issues. 

I wonder if there is a for-each loop or a conditional statement ahead of it that can check if a given linkage between two issues already exists, and do nothing in those instances to avoid the endless looping.

I've also looked into the Parent-Child functionality in Jira, but not 100% sure if changing the overall issue model would mesh well with our intended workflow.

Thanks,

Derek

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.
January 30, 2025

Thanks for that information, and regarding your response:

I wonder if there is a for-each loop or a conditional statement ahead of it that can check if a given linkage between two issues already exists, and do nothing in those instances to avoid the endless looping.

Rule branches which could be on more-than-one-thing are executed in parallel and asynchronously, with no predictable processing order.  And, there is no guarantee when the branch will complete, up until the last step of the rule.

Thus adding a condition inside of a branch for the rule you show would not help as it could pass one moment while an instant later the link is made by another processing thread, creating a cross-link.

This is one reason I noted using two rules; it reduces, but does not eliminate, the possibility of errors and collisions.  (A further mitigation would be to call the issue linking REST API endpoint directly, ignoring errors, rather than using the built-in Link Issue action.  But that introduces other risks.)

Derek LoGrande January 31, 2025

Ah I see. I will be trying your suggestion and also exploring other Jira plugins. Will update if it works.

Thanks!

Derek

Like Bill Sheboy likes this

Suggest an answer

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

Atlassian Community Events