How to synchronize custom fields?

Originally asked by Harold Oconitrillo on 10 November 2023 (original question)


Hello I am trying to sync custom fields and I would like a little help.

The case is I want when in Jira1 custom field is ‘yes’ on Jira 2 2 other fields to be “Yes” too. Can you please send me the outgoing and incoming script for this. Thank you


Answer by Javier Pozuelo on 21 November 2023

Hello Mario,

You need to place the following script in your connection:

Outgoing Sync Jira Cloud 1

replica.customFields."Bug" = issue.customFields."Bug"

Incoming Sync Of Jira Cloud 2

if(replica.customFields."Bug".value?.value == ["Yes"]){ 
	issue.customFields."Bug Fix Approved (Team Leaders)".value = ["Yes"] 
	issue.customFields."Bug fix reason"?.value = "NAVMOBILE"
}else{
	issue.customFields."Bug Fix Approved (Team Leaders)".value = [] 
	issue.customFields."Bug fix reason".value = null
}

Answer by Mario on 11 November 2023

The problem is that this check box may be checked after the task is created so it errors for a null object


Answer by Mario on 11 November 2023

Hello

I am sending a picture of the exact field. It is the same on both sides


Answer by Daniel Miks on 10 November 2023

Hi
It depends on what type of fields you use for the option “yes”. Is it a text field, list, or any other type.
Do you use Cloud or DC?

I would by with looking at this documentation:
https://docs.exalate.com/docs/how-to-synchronize-custom-fields-in-jira-cloud

This is for on-prem:
https://docs.exalate.com/docs/how-to-synchronize-custom-fields-in-jira-on-premise

Regards
Daniel Miks
Eficode