I'm trying to sync data between two jira instances. The connection is already established and working fine, but the data change between the instances is not working as expected. So I've tried to first do some investigation and set-up a secondary project (based on the configuration of the first one) in the same instance as the source. I've added some new custom fields and established the local connection. Within the code connection settings, I've added the following code within the outbound connection:
replica.customFields."11800" = issue.customFields."11100"
replica.customFields."11801" = issue.customFields."11200"
Inbound:
issue.customFields."11100".value = replica.customFields."11800"?.value
issue.customFields."11200".value = replica.customFields."11801"?.value
Nevertheless, after triggering the sync, a new issue in the secodary project is created, custom fields are populated as well, with the same values as the source, it's just that the wrong fields are populated in the destination project.
Source custom field values are populated to the same custom fields in the destination project. That means, I have the custom field 11100 in the source, that should be copied into the custom field 11800, but in the destination project, the custom field 11800 has no value, and the custom field 11100 is populated instead.
Is there anything that I'm doing wrong?
Thank you and best regards,
Peter
Hi @Serhiy Onyshchenko
1. The use case above is a sync between two projects on the same jira instance (local sync).
2. Yes, ID of the cf_11100 in project A should be synced into cf_11800 of project B.
3. Since it´s a local sync, there´s no Jira B. Only a project B.
Regards,
Peter
Hey, @Peter Pešta
Thanks for the clarification.
In this case your rules should contain the following lines
Outgoing sync:
replica.project = issue.project
if (issue.project.key == "A") {
replica.customFields."11100" = issue.customFields."11100" // exposes the value of custom field in project A to the scripting for project B
replica.customFields."11200" = issue.customFields."11200"
} else {
//// uncomment if you'd like the sync to be bi-directional:
// replica.customFields."11800" = issue.customFields."11800" // exposes the value of custom field in project B to the scripting for project A
// replica.customFields."11801" = issue.customFields."11801"
}
Incoming sync:
if (replica.project.key == "A") {
// sync A -> B
issue.customFields."11800".value = replica.customFields."11100"?.value // sets the value of the custom field 11800 in project B to the value sent from project A's 11100
issue.customFields."11801".value = replica.customFields."11200"?.value
//// note that you could also write
// issue."11800" = replica."11100"
// issue."11801" = replica."11200"
} else {
//// uncomment if you'd like the sync to be bi-directional:
//// sync B -> A
// issue.customFields."11100".value = replica.customFields."11800"?.value
// issue.customFields."11200".value = replica.customFields."11801"?.value
}
note, how in outgoing sync you simply copy values from issue variable to replica variable as-is, and the mapping of which value should go to where only happens in incoming processor.
Please, let me know if this helps.
If you have any more questions, we have a great community where Exalate users discuss scenarios like yours (https://community.exalate.com/). Or just reach out to support@exalate.com. We'll be happy to help!
Regards, Serhiy.
Hello, @Peter Pešta , I hope you're doing fine.
In regards to having field mapping configured visually, Exalate is definitely able to configure these rules without scripting:
https://drive.google.com/uc?export=download&id=1V7FrMTHe2MeFr-5yCTiv9jBzxJjaHckp
Regards, Serhiy.
(I'm a colleague of Serhiy, also working for Exalate)
The visual mode announcement video is available at
https://www.youtube.com/watch?v=-CJlH_SDIl8
@Peter Pešta, in case you don't want to be dragged into scripts and maintaining them, you could also check out our app, Backbone Issue Sync for Jira or other issue sync apps if they better meet your needs.
With Backbone, you don't have to deal with customfield ids for setting up the sync, but simply map it via our UI. If you're interested in a demo, you can request one via our webpage.
Cheers,
Matthias.