The Atlassian Community Forums are currently in read-only mode. We will be relaunching on a new platform on September 22 (read more here). We apologize for the extended downtime. For concerns or questions, please email communitymanagers@atlassian.com. See you on the other side, on the new Atlassian Community Forums! :)

×

Forums

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

How to place a comment on linked issues in specific project?

rik nackaerts
July 22, 2022

Hi,

Our issues can contain multiple links with the same linktype (eg "is cloned by") but linked to different projects (eg. JIRA1, JIRA2,...).

I only want to place comments (postscript) on linked issues in project JIRA1, how would the Groovy script have to look like?

issue.getLinkedIssues("is cloned by") returns me a list of all the linked issues with this linktype, but I want to narrow it down to only the linked issues from project JIRA1. 

Many thanks in advance!
Rik

1 answer

1 accepted

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

0 votes
Answer accepted
Florian Bonniec
Community Champion
July 22, 2022

Hi

 

Before doing it with groovy script have you try to use automation for JIRA ? By doing a branch on linked issues then add a condition on the project = JIRA1 then comment ?

 

Regarding groovy script I' m a bit surprise that issue.getLinkedIssues("is cloned by") return something but if it does and if it' s a list of Issue Object you can narrow to get only those from a project by doing:

 

issue.getLinkedIssues("is cloned by").findAll{ it.getProjectObject().getKey() == "JIRA1"}

 

This will return only the issues from the project JIRA1 from your initial list. Use find instead of findAll if you only want the first Issue.

 

Regards

rik nackaerts
July 25, 2022

Don't have access to the branch option of automation, so that's no option.

Your solution does it's work splendid by the way :)

Thanks!