Automatically make a comment on a linked issue in another project
Use a ScriptRunner to automatically add a comment to linked issues in Project 1 when an issue from Project 2 is Resolved.
Also the comment can include a link back to the Project 2 issue and the summary of that issue.
import com.atlassian.jira.bc.issue.search.SearchService import com.atlassian.jira.component.ComponentAccessor import com.atlassian.jira.jql.parser.JqlQueryParser import com.atlassian.jira.web.bean.PagerFilter // text field containing tiny url *name* def textFieldName = "Tiny URL" def issueManager = ComponentAccessor.getIssueManager() def customFieldManager = ComponentAccessor.getCustomFieldManager() def jqlQueryParser = ComponentAccessor.getComponent(JqlQueryParser) def searchService = ComponentAccessor.getComponent(SearchService) def user = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser() def commentManager = ComponentAccessor.getCommentManager() def resolvedIssue = issue def cf = customFieldManager.getCustomFieldObjectByName(textFieldName) def tinyUrl = resolvedIssue.getCustomFieldValue(cf) // update this query with the project(s) you want to search for the matching url def query = jqlQueryParser.parseQuery("issueFunction in issueFieldExactMatch('project in (JRTWO)', '$textFieldName', '$tinyUrl')") def searchResults = searchService.search(user, query, PagerFilter.getUnlimitedFilter()) searchResults.issues.each { issue -> def commentBody = """${resolvedIssue.key} has been resolved: {quote} ${resolvedIssue.summary} {quote} """ commentManager.create(issueManager.getIssueObject(issue.id), user, commentBody, true) }
Related articles