Confluence has been updated to version 6.15.9

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Status
subtletrue
colourGreen
titlejira

...

on-premise

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
showLabelsfalse
showSpacefalse
cqllabel = "customfieldhandling"

...