Introduction
Since we can not use the HTTP Client in Jira On Prem to link tickets, we are going to use the Component Accessor.
The only requirement is that in the source side (This can be any ITSM that we support), the ticket ID of it's linked counterpart gets sent.
Then on the incoming sync in Jira we just have to implement this and we are good to go.
Right now it is a "Relates To" link, if you want to change that, please change the linkTypeId in the following code.
//imports import com.atlassian.jira.issue.IssueManager import com.atlassian.jira.component.ComponentAccessor import com.atlassian.jira.issue.link.IssueLinkManager if(replica.relationid){ //getting Issue Manager component def issueKeyFinder = ComponentAccessor.getComponent(IssueManager) //sourceIssueId def idThisIssue = issueKeyFinder.getIssueByCurrentKey(issue.key) //destinationIssueId def exalateId = nodeHelper.getLocalIssueFromRemoteUrn(replica?.relationid)?.key def idIssueToBeLinked = issueKeyFinder.getIssueByCurrentKey(exalateId) def sourceIssueId = idThisIssue.id def destinationIssueId = idIssueToBeLinked.id def linkTypeId = 10003 def sequence = 1L def remoteUser = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser() def issueLinkManager = ComponentAccessor.getComponent(IssueLinkManager) issueLinkManager.createIssueLink(sourceIssueId, destinationIssueId, linkTypeId, sequence, remoteUser) }
Questions
Recent Questions
- 0votes
- 0votes
- 0votes
- 0votes
- 0votes
- 0votes
- 0votes
- 0votes
- 0votes
- 1vote