Bulk Comments on Linked Issues

Katherine Stevens March 12, 2024

I ran this JQL in scriptRunner

project = XXX and issueFunction in linkedIssuesOf("resolution = unresolved and project in ("XX", "YY")")

I see all the tickets that have open linked issues.  However, I don't see an option now for making bulk comments on those open linked issues (Project XX, YY).  Any suggestions?


2 answers

1 accepted

1 vote
Answer accepted
Hernán Paggi March 12, 2024

Hi @Katherine Stevens

Directly from JQL and the Jira search interface, it is not possible to perform mass actions that affect directly linked issues. But, you can try this:

1 - You should write a script that first runs your JQL query to get the list of issues
2 - For each issue found, the script should search for its linked issues that meet your criteria (in this case, those that are in projects XX and YY and that are unresolved)
3 - Finally, the script will use the Jira API to make comments on those linked issues

This is a sample code (adapt to your needs)

import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.link.IssueLink
import com.atlassian.jira.issue.comments.CommentManager
import com.atlassian.jira.issue.Issue
import com.atlassian.jira.issue.IssueManager
import com.atlassian.jira.user.ApplicationUser

// Define the comment to be added
String comments = "This is a massive comment"

// Obtains necessary services
IssueManager issueManager = ComponentAccessor.getIssueManager()
CommentManager commentManager = ComponentAccessor.getCommentManager()
ApplicationUser user = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser()

// Get issues based on your JQL
List<Issue> issues = // Your logic to get the list of issues based on your JQL

issues.each { Issue issue ->
// Gets the current issue links
List<IssueLink> links = ComponentAccessor.getIssueLinkManager().getOutwardLinks(issue.id)
links.each { IssueLink link ->
Issue linkedIssue = issueManager.getIssueObject(link.destinationId)
// Verify if the linked issue meets your criteria
if (linkedIssue.projectObject.key in ["XX", "YY"] && !linkedIssue.resolution) {
// Add the comment to the linked issue
commentManager.create(linkedIssue, user, comments, false)


Katherine Stevens March 12, 2024

Thank you!  I'll have my developer help me with the script!  Thank you!

Hernán Paggi March 12, 2024

You're welcome, I'm glad you found the solution helpful.

1 vote
Katherine Stevens March 12, 2024

I just realized that I can do the sync filter and then it will pull it up in and I can do the bulk changes.

Thanks again!

Hernán Paggi March 12, 2024


Suggest an answer

Log in or Sign up to answer
Site Admin
AUG Leaders

Atlassian Community Events