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:
Thanks!
Hi @Derek LoGrande -- Welcome to the Atlassian Community!
Such scenarios are challenging, risky, and brittle to manage with Jira and automation rules. Please consider:
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
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Ah I see. I will be trying your suggestion and also exploring other Jira plugins. Will update if it works.
Thanks!
Derek
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.