xl8bot
1
Originally asked by Martin Niňaj on 13 July 2023 (original question)
Hello, syncing epics works, but only for issues for that specific project.
How to sync epics and its issues, when epic have issues from more projects?
Other projects should be also synchronised.
Jira <> Jira on premise instances
thank you!
xl8bot
2
Answer by Mathieu Lepoutre on 15 September 2023
Hi
Let’s use the component Accessor for this.
//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)
}
xl8bot
Closed
3
This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.