Answer by Christophe De Beule on 27 October 2023
Hi Clélia MATHIEU,
To set the “Account” custom field that is coming from Tempo you’ll need to give it the right ID.
So to do this with Exalate you need to sync over the “Account” field first in the outgoing sync.
Outgoing Sync
replica.customFields."Account" = issue.customFields."Account"
To see how Exalate synced over this field you can check the Entity Sync Status.
"customFields": {
"Account": {
"id": 10073,
"name": "Account",
"uid": "10073",
"type": "UNHANDLED",
"value": {
"id": 2,
"value": "<your account name>"
}
}
Tempo will automatically set the account name if you have the right ID, so when you set your “Account” field you need to use the id that you have on that instance.
!note that you cannot give it a string value, the account name needs to exsist on that Jira instance!
You can find the id of the tempo account in the Tempo addon under Accounts, Click on the account you want the ID from and in the URL bar you can find it.
“1” is the ID
Looks like this
https://<your cloud domain>/plugins/servlet/ac/io.tempo.jira/tempo-app#!/accounts/account/1/
When you have found the ID’s on both instances you can create a Map to set the values.
Incoming Sync
// The first value in the Map is from the remote side
// Note that the first value is from the data type String
// Change the ID's to the ones you have
def tempoAccountMap = [
// "Remote Jira":Local Jira
"2":1,
"3":2
]
// So the first value (String) is the id from the tempo account on the //remote side
// as you can see we call it by replica.customFields."Account".value.id and we'll convert it to the id we need on the local side.
def tempoId = replica.customFields."Account".value.id
// tempoId is from the data type "com.google.gson.JsonPrimitive" we cannot convert this to an int so we converted it to a String, that's why we set the first value to a string in the Map
// The value we get from that map is an Int (the ID on the local side)
issue.customFields."Account".value = tempoAccountMap[tempoId.toString()]
Now if you mapped the ID’s the right way you can see it will update the “Account” field to the ones you have on the local Jira.
If this Jira does not have accounts on Tempo it will not be created.
I hope this answers your question.
Kind regards,
Christophe De Beule