List linked issues in comment
Asked by JD:

Hi - I am trying to setup an automation that lists out all linked issues in a comment on the ticket. I'd like those issues to be clickable (i.e. not just the text but an actual URL).

I found a few examples in the community using Lookup Issues and thought the below would work (at one point it did work but I can't seem to get it worked again!).

The steps I have are

* When issues is transitioned to a specific status
* Then Lookup Issue (using the JQL below)

```
issue IN linkedIssues("{{issue.key}}")
```

* And Add a Comment (using below format)

```
View linked issues below

{{#lookupIssues}}
* {{key}}
{{/}}
```

This automation runs successfully and it adds the comment but it doesn't insert any issues into the comment, even though there is a linked issue on the ticket.

On the audit log, there is a message that says "A search during custom value definition found no issues."

If I do a Jira search using the JQL but replacing the {{issue.key}} with the actual issue key, it returns all the linked issues fine.

I've also tried triggering this automation manually and it doesn't work either.

Any help would be appreciated!


Answers:
author: Marco Augusto Santinho Gon?alves
body: just use {{issue.issuelinks}}

comments: author: Sam Katz
body: Hi [@Marco Augusto Santinho Gon?alves](/t5/user/viewprofilepage/user-id/2895498) thank you for this, do you know if this can be used to include the URLs of the linked issues as well? I tried a few combinations such as

{{issue.url.issuelinks}}

{{issue.issuelinks.url}}

but those did not seem to return any value.

Any ideas?

Thanks!


author: Eric
body: Hi [@JD](/t5/user/viewprofilepage/user-id/830333)

On a cursory glance, I can't see anything wrong with the rule you described. I also find it weird that the audit log says no issues but searching manually returns some results.

Are you able to take a screenshot of your rule and the audit log?

Cheers,

Eric

comments: author: JD
body: Hi [@Eric](/t5/user/viewprofilepage/user-id/515406) - thanks for the reply.

I've inserted screenshots below (this is a copy of the original issue but same issue is occuring).

Setup below

<br />

![CleanShot 2022-05-27 at 07.49.51.png](https://community.atlassian.com/t5/image/serverpage/image-id/199418iB390CC3891187283/image-size/large?v=v2&px=999 "CleanShot 2022-05-27 at 07.49.51.png")![CleanShot 2022-05-27 at 07.49.58.png](https://community.atlassian.com/t5/image/serverpage/image-id/199420i690B46294021C026/image-size/large?v=v2&px=999 "CleanShot 2022-05-27 at 07.49.58.png")

![CleanShot 2022-05-27 at 07.50.03.png](https://community.atlassian.com/t5/image/serverpage/image-id/199421i87B239364709D10F/image-size/large?v=v2&px=999 "CleanShot 2022-05-27 at 07.50.03.png")

Here is the audit log. Note that it is 'successful' but the lookup fails to find any issues.

![CleanShot 2022-05-27 at 07.57.58.png](https://community.atlassian.com/t5/image/serverpage/image-id/199425i1BBBAA5D80DBD8EE/image-size/large?v=v2&px=999 "CleanShot 2022-05-27 at 07.57.58.png")

Here is an issue where I've run the automation (relating to the audit log above). Note the existence of a linked issue and the comment is added, but nothing is linked.

![CleanShot 2022-05-27 at 07.55.35.png](https://community.atlassian.com/t5/image/serverpage/image-id/199424i91138435798178BF/image-size/large?v=v2&px=999 "CleanShot 2022-05-27 at 07.55.35.png")


author: Vanjinathan Ramalingam
body: Hi JD, Did you manage to get the solution? Im also looking for a solution to  
List linked issues in comment.


author: Tomas Slavkovsky
body: IMHO, the problem is in the lookupissues JQL because in the audit log, you can see:

"A search during custom value definition found no issues."

Meaning there are no entries for this JQL query.


author: Majken Longlade
body: I think I found the problem! Project-based automation rules only turn up issues in the same project. In your screenshots, you're showing an issue that exists in another project. You'd need to convert the rule to a global rule to get results from other projects.


author: Robin Powell
body: I agree with [@Tomas Slavkovsky](/t5/user/viewprofilepage/user-id/4482077), I think this is a bug in the JQL handling. I'm running a rule that does a ++lookupissues++ running this query:

*Project = XXX AND issueFunction in completeInSprint({{Sprint.originBoardId}}, '{{Sprint}}')*

When the rule runs, I have it print the above statement into the audit log, and at that point the JQL it sees looks like this:

*Project = XXX AND issueFunction in completeInSprint(9843, '2022.PI2.S10')*

When the rule executes, I get a message saying "++A search during custom value definition found no issues.++" However, if I run the "translated" JQL (shown in the audit log) in an issue search, it returns 3 issues, which is the expected result.

* **All of my issues are in the same project.**
* **If I change the lookupissues to "Project = XXX and status = Done and Sprint = {{Sprint}}" it returns 3 issues, as expected.**

To narrow things down, I tried:

* "Project = XXX and issueFunction in completeInSprint(9843, '{{Sprint}}')" to see if it was multiple smart values causing the issue, but that also failed with "A search during custom value definition found no issues".
* I even took all of the smart values out and replaced them with actual values, and it still failed.

The introduction of a Scriptrunner function (I've tried several others with the same results) seems to be causing the problem for me.