We are using Exalate to synchronize issues, but we encountered an issue where we can’t add issue links to issue.issueLinks
in the incoming processor. Do we need to use the com.exalate.basic.domain.hubobject.v1.BasicHubIssueLink
class to link Jira Cloud issues, and if so, how do we implement it?
To synchronize issue links between Jira Cloud issues using Exalate, you can retrieve the issue links of an issue and Exalate each one automatically. Here’s a Groovy script to achieve this:
JC Outgoing sync:
replica.issueLinks = issue.issueLinks
def issueLinks = httpClient.get("/rest/api/3/issue/" + issueKey.id).fields.issuelinks
def issueLinksList = issueLinks instanceof List ? issueLinks : (issueLinks ? [issueLinks] : [])
issueLinksList.collect { it ->
if (it.inwardIssue) {
def issueLinkKey = new com.exalate.basic.domain.BasicIssueKey(it.inwardIssue.id, it.inwardIssue.key)
syncHelper.exalate(issueLinkKey)
}
}
Incoming sync:
issue.issueLinks = replica.issueLinks
Explanation:
- Retrieve Issue Links: This script fetches the issue links of a Jira issue using the
/rest/api/3/issue/{issueKey}.json
endpoint. - Handle Single and Multiple Links: The
issueLinks
field is checked to see if it’s a list; if not, it’s wrapped into one to ensure compatibility with the.collect
method. - Exalate the Links: The script loops through each link and synchronizes it by creating a
BasicIssueKey
for the linked issue and callingsyncHelper.exalate()
.
This approach will handle both single and multiple issue links correctly.
This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.