Find linked issues of linked issue
Asked by Natasha Richardson:

I am trying to find the linked issues of a linked issue and check the status and then transition them.

I have a Manual trigger that closes an issue and then a branch to check the FOR Linked issue of type "blocks" and close any child related tickets on that linked issue. That linked issue also has linked issues of "relates to" type but I can't get to it to check. I can reach the Child tickets of the linked ticket but not the linked issues of that linked ticket. I have tried using the related issue condition for sub-tasks and linked issues.

Also open to other ways of achieving this. TIA.

![Screenshot 2024-07-30 092314.png](https://community.atlassian.com/t5/image/serverpage/image-id/338876i17F901A60A17CE75/image-size/large?v=v2&px=999 "Screenshot 2024-07-30 092314.png")


Answers:
author: Bill Sheboy
body: Hi [@Natasha Richardson](/t5/user/viewprofilepage/user-id/5520290) -- Welcome to the Atlassian Community!

Rules do not support nested branching, and so a workaround for your scenario is:

1. once inside of the branch on the linked issues of the trigger issue...
2. use the {{issue.issuelinks}} smart value and list filtering / conditions to check the linked issues of those ones

Here are some references to help with those techniques:

* *To help understand the smart value structures, view an example issue with this how-to article* : <https://support.atlassian.com/cloud-automation/docs/find-the-smart-value-for-a-field/>
* *To learn about filtering the list of values in {{issue.issuelinks}}, please see this article* : <https://community.atlassian.com/t5/Automation-articles/Filtering-smart-value-lists/ba-p/1827588>
* *To learn the available inline and other conditional logic, please see this documentation* : <https://support.atlassian.com/cloud-automation/docs/jira-smart-values-conditional-logic/>

Depending upon the criteria you need, this may be complicated to implement. I recommend first testing without any issue updates, and instead just write to the audit log. Once it is all working you could adjust the rule to perform updates.

Kind regards,  
Bill

comments: author: Natasha Richardson
body: Thanks, Bill! So I ended up doing a lookup in the branch and I am getting to the linked issue that I want now per the log actions but then when I do the comparison of the smart-value, its still grabbing the first linked issue. Just wanted to see if you had any ideas here if not no worries.

issue in linkedIssues("{{firstLevelLinkedIssueKey}}", "relates to")

![Screenshot 2024-07-31 082931.png](https://community.atlassian.com/t5/image/serverpage/image-id/339141iCEB1CD4407B4D999/image-size/large?v=v2&px=999 "Screenshot 2024-07-31 082931.png")


author: Bill Sheboy
body: Would you please post images of the create variable actions and of the audit log details showing the rule execution? Thanks!


author: Natasha Richardson
body: Certainly! Here it is:

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

![secondLevelLinkedIssueKey.png](https://community.atlassian.com/t5/image/serverpage/image-id/339197iDB0B4FF90CDA2363/image-size/large?v=v2&px=999 "secondLevelLinkedIssueKey.png")![smartvalecondition.png](https://community.atlassian.com/t5/image/serverpage/image-id/339198i7A8E3EFDB40E6411/image-size/large?v=v2&px=999 "smartvalecondition.png")![log.png](https://community.atlassian.com/t5/image/serverpage/image-id/339199i78CD50C104D1D0CC/image-size/large?v=v2&px=999 "log.png")


author: Bill Sheboy
body: First for those writes to the audit log, please add some labeling to confirm what we are observing. For example:

```
firstLevelLinkedIssueKey: {{firstLevelLinkedIssueKey}}
```

Next, for more context please show images of the *entire updated automation rule* and of the *entire audit log details for that rule execution*. Those will help distinguish which issues are being acted upon in the rule steps.


author: Natasha Richardson
body: OK, sorry I thought that was what you needed. Yes 28312 is the firstLevelLinkedIssueKey and 28311 is the secondLevelLinkedKey so it's finding the correct issues but for whatever reason the smartvalue condition check is referencing 28312 when it should reference 28311 from the lookup. But I actually am thinking of going in another direction altogether because I think this is getting too complex. I am going to just link the issue I need to the issue I am running the manual automation against and then check the status from there.


author: Carla Ann Rowland
body: Looks like you need another branch to check for related issue link -- it will probably be best to separate them the rules. Your 1st rule takes the first level of children that are block.

But to set the criteria again to look at the children of the linked tickets I think the logic cannot handle it.

I suggest: linked issue you just closed based on criteria above had a rule:

If linked issue is block by is closed then if sub-tasks exist then close them. If there is that allows this rule to be called by other automation then allow that to happen.

---

hope this helps.


Tags: cloud

jira-cloud