Forums

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

Automation for Linked Issues

Nuno Pimenta (ADM) July 21, 2023

Hi Community,

I'm trying to figure out the best way to kinda "replicate" this type of legacy automation to non JSM project

Screenshot 2023-07-21 at 12.22.00.png

The Target is, on a Software Project Issue, when a linked issue is transitioned to "Done" a comment is placed on the main issue.

 

I noticed that one way is to have automation in "all involved projects" on transition and update linked issues with a comment, but besides the need to have one automation for each project, the scope is only for that project, and don't drop comments if the linked issue is in another one. 

Asking for any ideas on this or if its even doable 

thanks

1 answer

2 votes
Patrik Korovsky
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 21, 2023

Hello @Nuno Pimenta (ADM)

It seems you would like to add a comment to an issue in a software project whenever a linked issue transitions to "Done", regardless of the project the linked issue is in.

For this you will follow this step-by-step:

  1. Go to Global Automation (found in the Jira settings).
  2. Click on 'Create rule' button.
  3. In the 'Rule details' section, set the scope of the automation to 'All projects'.
  4. For the trigger, choose 'Issue transitioned'. You will need to select the 'To Status', which in your case would be 'Done'.
  5. Then, under 'Add component', select 'New branch' and choose 'For each' > 'Branch rule / related issues'.
  6. In the 'Type of related issues', select 'Linked issues', and for the link types, select 'is caused by' and 'causes'.
  7. Within the branch rule, add an action to 'Comment on issue'.
  8. Customise the comment as needed. (For example 'Cause resolved: {{triggerissue.key}}')

Comment_caused.png

This will ensure that whenever an issue that is linked (either as 'is caused by' or 'causes') transitions to 'Done', a comment will be added to the related issue.

Please note that in the JSM project the transition is statuscategory which means that for the software project you will have to select all statuses that fall within that category. For example in your workflow this might also include 'Finished' or 'Discarded'.

If I may suggest an adjustment. From a logical perspective it would make sense to only add this comment to the ticket that causes the issue as you would like to know that the cause is 'done' and not that ticket that is caused by the cause is done.

  • You have two issues: Issue A and Issue B.
  • Issue A caused Issue B (A -> B).
  • When Issue B (the issue that was caused) gets resolved (Done), the suggestion is to automatically add a comment to Issue A (the issue that caused B) to say that Issue B is now resolved.

Let me know if you need help finetuning the automation.

Best regards,
Patrik

Nuno Pimenta (ADM) July 21, 2023

Thank You for this Patrik! 

Quick question, being in the Global Automation, this will be applied to all Projects that have linked issues?

 

asking because the goal here is,

I have a Project that can cause linked issues in Projects B, D, F, and Z, when these linked issues get transitioned to done a comment is placed in Project A main issue (your suggestion on only causes makes sense).

But this only for Project A, all other projects inside the Jira environment should have this implemented for their issues.

 

thanks!

Patrik Korovsky
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 21, 2023

Happy to help, @Nuno Pimenta (ADM),
Yes, you are right. The Global Automation rule would apply to all projects in your Jira instance. However, it does not mean it will affect all the issues in all projects unless they meet the rule criteria.

Adjusted for your goal

'I have a Project A that can cause linked issues in Projects B, D, F, and Z, when these linked issues get transitioned to done a comment is placed in Project A main issue (your suggestion on only causes makes sense).'

Your requirement suggests that is caused by should be used, not causes as you want to add a comment to Project A issue (is caused by = Main Issue) not Project B, D, F or Z. When working with linked issues you have to understand that we are running the automation from the trigger issue (Project B, D, F, or Z = is caused by A) on the destination (Project A cause).

I would also suggest that when the main issue in Project A is resolved, you should consider adding a comment on the linked issues in Projects B, D, F, and Z. Especially if resolving the main issue in Project A unblocks or affects the linked issues in some way. This would mean using causes when the Project A is transitioned do Done. This is not accounted for in the automation below (I stuck to your requirement in your previous comment).

Here is a rewritten automation to suit your needs:

FullRule.png

  1. When: Issue transitioned to 'Done'
  2. Issue fields condition: Field 'Project' + Condition 'is one of' = Value "'Project B' 'Project D' 'Project F' 'Project Z'"
    1. Branch rule / related issues: Type of related issues 'Linked issues' + Link types 'is caused by'Issue fields condition: Field 'Project' + Condition 'equals' = Value 'Project A'
    2. Comment on issue 'Comment' (I suggest: 'The Caused linked issue has been resolved: {{triggerissue.key}}')
  3. Branch rule / related issues: Type of related issues 'Linked issues' + Link types 'is caused by'
    1. JQL condition: JQL 'project = "{{triggerIssue.project.name}}"'
    2. Comment on issue 'Comment' (I suggest: 'The Caused linked issue has been resolved: {{triggerissue.key}}')

OverviewLinks.png
The 3. component ensures that comments are only added to Project A's issues, even though the automation runs globally.

 ProjectA.png

The 4. component extends the automation to add a comment to issues within the same project when linked issues are resolved.

 SameProject.png

Projects that are neither A or the same as the trigger issue have no actions performed against them.

 DifferentProject.png

Please also consider the following

  • Handling Other Transitions: The automation rule currently only covers issues that transition to 'Done'. If there are other important transitions in your workflow that you would like to track, you would need to modify or duplicate this rule to cover those transitions.
  • Handling Different Link Types: If there are different types of issue links you use within and between projects, you may need to create different rules or modify this one to handle those different link types. This would require adding additional conditions to check for the specific link type.

I hope this helps!

Let me know if you need further clarification.

Like # people like this
Nuno Pimenta (ADM) July 27, 2023

Thank You Patrik! Works like a charm!

I have added an extra condition, so it will check all linked issues, and only drop a comment when the last one is done.

Like Patrik Korovsky likes this

Suggest an answer

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

Atlassian Community Events