Forums

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

How do I create an automation to link issues together with the same label?

Brian Alves August 5, 2024

I am trying to link issues with the same label. 

So if I create 10 issues with the label "test" I'd like to run a rule to link them. 

This is the automation I'm working with and not getting any success :( Screenshot 2024-08-05 at 11.28.09 AM.pngth right now and have not had any success


2 answers

1 accepted

2 votes
Answer accepted
Trudy Claspill
Community Champion
August 5, 2024

Hello @Brian Alves 

Welcome to the Atlassian community.

What event do you want to trigger this rule? Do you want it to be triggered each time a new issue is created, then have it find all the other issues with the same label as the trigger issue, and link the trigger issue to all the issues found?

Do you want to trigger the rule after all 10 issues have been created? And then create a link between each of those 10 issues and all the other 9 issues in the set (so each of the 10 issues has links to 9 other issues)?

An issue can have more than one value in the Labels field. How is your rule going to know the relevant Label value? 

Do you want to be able to run this rule for different label values?

 

Brian Alves August 6, 2024

Hi @Trudy Claspill ! 

Yes I would like to run on every issue and group specific labels with each other. I'm hoping to have multiple labels then create a rule for each label to link with eachother. 

If I create an initiative with 10 items in it and 2 labels. So 5 items would have label 'test' the other 5 would have label 'test2' then the automation would link issues with the same label together. Not necessarily to any trigger issue. 

Does that make sense?

Trudy Claspill
Community Champion
August 6, 2024

I am still not clear on when you want the rule to trigger.

Let us say it is triggered upon the creation of a single issue. And that issue may have 0..n Labels values.

I think this is the type of flow you're looking for. Correct me if I'm wrong.

When issue created
And Labels is not empty
For each Labels value
  Find other issues that have the same Labels value
    For each issue found
      Link that issue to the rule's trigger issue.

Unfortunately Automation Rules don't support nesting For branches in that manner.

Are you trying to incorporate this linking into an Automation Rule where you are also creating the Initiative and the child issues? Or is the issue creation being done manually?

Might you create more issues with the same Labels that you used previously ('test' and 'test2')? Should those new issues be linked to the ones created before?

 

Brian Alves August 6, 2024

ah okay so I will keep this simple

If I create issues that share the same label I want to them to automatically linked to one another based on label. So if I create 10 issues with 1 label in each of those issues then they should all connect to one another.

 

When issue created
  Label = test
    Link to one another with label

Trudy Claspill
Community Champion
August 6, 2024

So you want this triggered when an issue is created? 

And you are willing to hard-code the label value into the rule?

In that case the flow would be:

When Issue Created
And Labels in ("test")
For Related Issues / JQL
JQL: key != {{triggerIssue.key}} and Labels in ("test")
Link issues
link to Trigger Issue

Screenshot 2024-08-06 at 2.33.48 PM.png

Screenshot 2024-08-06 at 2.33.58 PM.png

Screenshot 2024-08-06 at 2.34.12 PM.png

 

 

 

Screenshot 2024-08-06 at 2.34.21 PM.png

 

 

 

 

Brian Alves August 6, 2024

Thank you! The first part is great, but I'm still having a tough time linking every item to one another. 

So Task1, task 2, task 3, task4 and task5 are created

task 1 should be linked to t2 t3 t4 t5

task 2 should be linked to t1 t3 t4 t5

task 3 should be linked to t1 t2 t4 t5

task 4 should be linked to t1 t2 t3 t5

task 5 should be linked to t1 t2 t3 t4

Trudy Claspill
Community Champion
August 6, 2024

Since the rule is run as each issue is created, and if they are created in the order of t1 through t5...

The rule will trigger when t1 is created. There will be no issues to link to at that point.

The rule will trigger when t2 is created. At that point there is only t1 that matches, so t1 will be linked to t2.

The rule will be triggered when t3 is created. At that point t1 and t2 match, so t3 will be linked to each of them.

At this point t1 is linked to t2 and t3. t2 is linked to t1 and t3. t3 is linked to t1 and t2

The rule is triggered when t4 is created. t1, t2, and t3 match, so t4 will be linked to all of them

The rule is triggered when t5 is created. t1, t2, t3, and t4 match, so t5 will be linked to all of them.

In the end after the rule runs for each newly created issue, they will all be linked to each other.

 

Brian Alves August 6, 2024

Ahhh I'm not getting that it's only linking to the trigger issue. But I am utilizing another automation to create the tickets, does tha tmake a difference? 

Currently I am creating a task
if task is created the create subtasks
subtasks have these labels which is where I need the linking done

Trudy Claspill
Community Champion
August 6, 2024

I think I asked you about that...

Are you trying to incorporate this linking into an Automation Rule where you are also creating the Initiative and the child issues? Or is the issue creation being done manually?

If you want to try to incorporate this into another rule where you are creating the issues then please show us that complete rule.

Keeping the linking rule as a separate rule should work. However there may end up being timing issues. I recommend that you do a limited run test to see how it works out.

Given that these are subtasks that have the labels you can enhance the rules in some additional ways.

  • After the trigger add a condition to check if the Issue Type is Sub-task.
  • Within the JQL in the Lookup Issues action add conditions:
    • AND issueType in subtaskIssueTypes() and parent = "{{triggerIssue.parent.key}}"

Also, if you keep this as a separate rule there is a checkbox on the Rule Details page that you will have to check to allow the linking rule to be triggered by the creation of issues in another rule.

Screenshot 2024-08-06 at 3.57.03 PM.png

Brian Alves August 6, 2024

Ah sorry I missed that. You did it! Thank you so much. 

Last question for you, can I create a condition in JQL where it's only created today?

Trudy Claspill
Community Champion
August 6, 2024

Yes, you can.

Add this

AND created > startOfDay()

Trudy Claspill
Community Champion
August 6, 2024

You can learn more about functions, keywords, and fields you can use in JQL here

https://support.atlassian.com/jira-software-cloud/docs/what-is-advanced-search-in-jira-cloud/

Trudy Claspill
Community Champion
August 6, 2024

If my responses have helped you solve your requirement please consider clicking the Accept Answer button to mark your post as Solved.

Like Brian Alves likes this
1 vote
Samuel Gatica _ServiceRocket_
Community Champion
August 5, 2024

Hi @Brian Alves 

Welcome to the comunity!

You need to create a new branch to investigate the issue with the same labels, after which you can link the newly created issue with the others.

i.e

Screenshot_1.png

 

Hope this helps!

Best regards

Sam

Trudy Claspill
Community Champion
August 5, 2024

That assumes that the issue created (the trigger issue) has the value "test" in its Labels.

Brian Alves August 6, 2024

Hi @Samuel Gatica _ServiceRocket_ ! 

I would like to run on every issue and group specific labels with each other. I'm hoping to have multiple labels then create a rule for each label to link with eachother. 

If I create an initiative with 10 items in it and 2 labels. So 5 items would have label 'test' the other 5 would have label 'test2' then the automation would link issues with the same label together. Not necessarily to any trigger issue. 

Suggest an answer

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

Atlassian Community Events