How do I search for linked issues using an automation?
Asked by Andre de Castro:

Hello, everyone.

I have an automation that creates a new card (B) when I change the status of a card (A), linking the two. This works correctly.  
But now, I need the new card (B) to have the same related issues as card (A).  
How can I improve this automation so that the related issues from card (A) are copied to card (B)? Thanks for your help


Answers:
author: Trudy Claspill
body: Hello [@Andre de Castro](/t5/user/viewprofilepage/user-id/4468945)

Whenever you ask for help with an Automation Rule, it will enable us to help you more effectively if you provide screen images showing the entire rule and the details of each step.

We can't advise you on how to improve a rule when we don't know the components of the rule you're trying to improve.

comments: author: Andre de Castro
body: Hi, Trudy.

This is the automation I'm trying to do and it's not working 100% ok.  
As I said before, when card A is transacted from status, card B is being created in another project and both are linked.  
Now I need to take the linked issues from card A to card B and that's not working.  
The message I get is that no items were found in the search.  
Thank you.  
![jira3.JPG](https://community.atlassian.com/t5/image/serverpage/image-id/346329iFAE0DC5D0121EAF7/image-size/large?v=v2&px=999 "jira3.JPG")


author: Trudy Claspill
body: Thank you for that additional information.

Have you verified that the issue that triggered the rule has issues linked to it, using the View All Issues interface?

Are the issues linked to it in the same project as it, or different projects?

What is the Scope for the rule according to the Rule Details page? If the linked issues are in different project you will have to use a Multiple Project Scope rule and identify all the projects in which linked issues might exist. The Lookup Issues action is limited to retrieving issues that are in Projects that are in the Project Scope of the rule.


author: Andre de Castro
body: Hi, Trudy

"Have you checked whether the problem that triggered the rule has problems linked to it, using the View all problems interface?"  
==\> Yes

"Are the issues linked to it in the same project as it or in different projects?"  
==\> Different projects

"What is the Scope of the rule according to the Rule Details page? If the linked issues are in different projects, you need to use a Multi-Project Scope rule and identify all the projects in which the linked issues may exist. The Search for problems action is limited to retrieving problems that are in projects that are in the scope of the rule's project."  
==\> I've now adjusted the rule to global scope. Thanks

Result ==\> The target card (B) continues to be created and linked to card A.  
The automation now finds the related issues but they still don't appear related to card B. I still don't know how to solve it.

![Jira4.JPG](https://community.atlassian.com/t5/image/serverpage/image-id/346645i76107185E0C85C76/image-size/large?v=v2&px=999 "Jira4.JPG")  

![Jira5.png](https://community.atlassian.com/t5/image/serverpage/image-id/346646i46ECD54E7D594536/image-size/large?v=v2&px=999 "Jira5.png")  


author: Trudy Claspill
body: Hello [@Andre de Castro](/t5/user/viewprofilepage/user-id/4468945)

I recommend you use make these changes:

Delete the Lookup Issues action and the Create Variable action.

Within the Create Issue action select the Linked Issues field to set. Use that to create the link between the newly created issue and the trigger issue.

Delete the Link Issue action after the Create Issue action.

At that point add a Branch - For: Related Issues: Linked Issues. In this position the branch will iterate through all the issues linked to the trigger issue.

Within that branch add a Link Issue action. You can use a smart value to get the issue key for the issue you created in the rule, to link each of the trigger issue's linked issues to the issue that you created in the rule.

<https://support.atlassian.com/cloud-automation/docs/jira-smart-values-issues/#--createdIssue-->

Here is an example:

![Screenshot 2024-09-11 at 1.19.52?AM.png](https://community.atlassian.com/t5/image/serverpage/image-id/346764i9AD32C69D73D6F5D/image-size/large?v=v2&px=999 "Screenshot 2024-09-11 at 1.19.52?AM.png")


author: Andre de Castro
body: Hi Trudy.  
After your guidance, the automation worked correctly. Thank you.  
However, I didn't understand the use of smart value so I linked the issues (in the trigger issue) to the new issue created.  
Just one more question...  
Is it possible to make the linked issues in the newly created issue have the same type of link that they had in the trigger issue?  
At the moment, they all have the same type.

<br />

![jira6.JPG](https://community.atlassian.com/t5/image/serverpage/image-id/347732i7BBB208CCD2D3EC7/image-size/large?v=v2&px=999 "jira6.JPG")


author: Trudy Claspill
body: Hello Andre,

The first solution that comes to mind is to use multiple Branches with each one selecting a specific link type.

![Screenshot 2024-09-17 at 1.29.06?PM.png](https://community.atlassian.com/t5/image/serverpage/image-id/347847i26FA2612B4BBF6B7/image-size/large?v=v2&px=999 "Screenshot 2024-09-17 at 1.29.06?PM.png")

In each Branch in the Link Issue action you would choose the matching link type.


author: Andre de Castro
body: Thank you once again.


Tags: cloud

jira-cloud