Status |
---|
| |
---|
subtle | true |
---|
colour | Green |
---|
title | jira |
---|
|
...
This article describes how to sync issue links details to a custom field using JIRA using JIRA Issue Link API.
Source side
Send over the issue link details
Outgoing sync
Snippet |
---|
import com.atlassian.jira.component.ComponentAccessor
// ...
// other parts of the script are not shown for simplicity
def jIssue = ComponentAccessor
.getIssueManager()
.getIssueObject(issue.key)
def ilm = ComponentAccessor.getIssueLinkManager()
def linkToMapFn = { ldir ->
{ l ->
[
"from": [
"id": l.sourceObject.id,
"key": l.sourceObject.key
],
"to": [
"id": l.destinationObject.id,
"key": l.destinationObject.key
],
"direction": ldir,
"linkType": (ldir == "outward")? l.issueLinkType.outward : l.issueLinkType.inward,
"style": l.issueLinkType.style
]
}
}
replica.customKeys.issueLinks = [
"out": ilm
. getOutwardLinks(jIssue.id)
.collect(linkToMapFn("outward")),
"in": ilm
. getInwardLinks(jIssue.id)
.collect(linkToMapFn("inward"))
]replica.issueLinks = issue.issueLinks |
Destination Instance
Add the script below in the Incoming sync of the Destination instance to receive issue links information from the Source Instance.
...
Snippet |
---|
// add the links information to the custom field
issue.customFields."Custom field name".value = replica.issueLinks.toString()
|
See Also
Content by Label |
---|
showLabels | false |
---|
showSpace | false |
---|
cql | label = "customfieldhandling" |
---|
|
...