Originally asked by Bogdan Gorka on 19 October 2021 (original question)
I am looking for a solution how to pair an existing issue in one project with an existing issue in another project.
In the incoming sync, I would like to test two custom field content, which will help me to search for the existing issue in the other project.
I saw a solution posted by Francis Martens (Exalate) some time ago on Atlassian Community
Using his suggestion, I wanted to expand the code he proposed:
if (firstSync) {
issue.id = <fetch the appropriate target issue id>
}
To sum up, I am looking for a solution where I will be able to sync and connect with the existing remote issue (it will always be only one), when a certain JQL condition is met. In Jira Automation this JQL looks as follows
project = IFC AND issutype = Task AND “IFC_ID” = {{triggerissue.customfield_10100"}}
So in Exalate the sync should be initiated, if the local custom field value is found in the same custom field value in another specific project and issue.
I tried to draft the code but I doubt if it is correct
if (firstSync) {
issue.projectKey = "IFC"
issue.typeName = "Task"
//I want to sync only when the remote CustField "IFC_ID" equals the local CustField value
issue.customFields."IFC_ID".value = replica.customFields."IFC_ID"?.value
}
Can someone direct me how to write this line from Francis Martens (Exalate) ?
issue.id = <fetch the appropriate target issue id>