How to get the Remote issue urn to local custom field when an initiating the sync

Originally asked by Moogambigai G R on 16 December 2021 (original question)


Hi there,

I have Project A and Project B in same instance.

Project A is exalated to Project B i want Project B(Remote issue urn) should populate in Project A custom field. I am using scripted mode connection. Could you please assist.

Regards,

Moogambigai G R


Answer by Francis Martens (Exalate) on 16 December 2021

Check following document

How to update a local custom field with the remote issue key

This should do it.


Comments:

Moogambigai G R commented on 16 December 2021

'Thank you, Here What is incoming destination side and source side. I didn’t get.

Incoming sync (destination side)

123 if``(firstSync){``syncHelper.syncBackAfterProcessing()``}

Incoming sync (source side)

1 issue.customFields.``"remote issue key"``.value = replica.key

Below is my sync connection:

Outgoing Sync:

if (issue.project.key == “DAR” && issue.typeName == “Defect”)
{
replica.key = issue.key
replica.type = issue.type
replica.assignee = issue.assignee
replica.reporter = issue.reporter

replica.customFields.“11030” = issue.customFields.“11030”
replica.customFields.“10113” = issue.customFields.“10113”

}

Incoming Sync:

if(replica.project.key == “DAR” && replica.type.name == “Defect”) //sync A -> B
{
issue.projectKey = “OEM”
def issueTypeMapping = [
“Defect” : “Acquired Product Defect”
]

issue.typeName = issueTypeMapping[replica.type?.name] ?: “Acquired Product Defect”

issue.“17004” = replica.“11030” //Defect Change Type//OEM Defect Change Type
issue.“17006” = replica.“10113” //Customer Severity//OEM Customer Severity

issue.key = replica.key

issue.assignee = replica.assignee
issue.reporter = replica.reporter

}

Regards,

Moogambigai G R