How to show linked issues statuses and keys

Originally asked by Vygandas on 09 September 2020 (original question)


Hello,

Is there a way to create sync for exalate to show linked issues in Jira cloud from Jira Data Center.
For example
Jira Cloud issue X is synchronized with Jira Data center issue Y.
Issue Y have two linked issues A and B in different development projects.

How to show linked issues keys and statuses of A and B in Jira cloud issue X without creating them in Jira cloud.
I’ve tried implementing using - https://docs.idalko.com/exalate/display/ED/How+to+synchronize+issue+links+to+a+custom+field but had no success.

Thanks.


Answer by allenhsieh on 26 September 2020

How to display the remote issue link in a custom field

Hi Support,
I tried to sync up 3 different projects while making a custom filed to show parent’s ticket ULR or number.
I followed the step provided here:
https://docs.idalko.com/exalate/display/ED/How+to+display+the+remote+issue+link+in+a+custom+field

Below I inserted the code:
issue.customFields.“Epic Link”.value = issue.key

Yet, the filed in the project did not show any sign of link or parent number?

Can you please show me how to solve this issue?


Comments:

Francis Martens (Exalate) commented on 26 September 2020

It looks like that this is a separate problem and should be raised as a new question.

allenhsieh commented on 28 September 2020

OK, I will do that now~
Can you plz follow up on it?

Answer by Francis Martens (Exalate) on 10 September 2020

https://docs.idalko.com/exalate/display/ED/How+to+synchronize+issue+links+to+a+custom+field

This is the way to do it.

  • Collect all information into a custom field or custom key
  • Sync it over
  • Apply it on the cloud side.

> But had no success

If you provide details, we can see if we can help


Comments:

Vygandas commented on 10 September 2020

Hi Francis

At first i’ve added code block from documentation to Outgoing sync

//below section of for link sync and information to other jira
import com.atlassian.jira.component.ComponentAccessor
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 == "relates to")? l.issueLinkType.outward : l.issueLinkType.inward,
      "style": l.issueLinkType.style
    ]
  }
}
replica.customKeys.issueLinks = [
"out": ilm
  . getOutwardLinks(jIssue.id)
  .collect(linkToMapFn("relates to")),
"in": ilm
  . getInwardLinks(jIssue.id)
  .collect(linkToMapFn("relates to"))
]
//for inwards and outward added currently used issue links

In cloud Jira to which synchronizing data added this part in incoming sync

// add the links information to the custom field
issue.customFields."Remote Linked issues".value = replica.issueLinks.toString()
// below are additioanl fields which collect data but they add exalated issue key and status
//issue.customFields."Remote Linked Key".value = replica.key
//issue.customFields."Remote Linked Status".value = replica.status.name

So at this moment, I have a second option to create a custom field, which would contain linked issue statuses, key and would have automated updates for linked issue changes.
Then create new sync for custom fields from Jira DC to Jira cloud

But I would greatly appreciate it if there could be a way without our developers coding custom field which would have such functionality.

Francis Martens (Exalate) commented on 10 September 2020

Line 2 in your incoming sync is wrong.
In the outgoing - you are storing the data into replica.customKeys.issueLinks

In the incoming - you are getting the data from replica.issueLinks - which is also a valid object.

Please rectify the incoming sync and inspect if the data you get is the data you expect by doing a

throw new Exception("...")

As explained in the Debugging Sync scripts on Exalate