Originally asked by Ariel Aguilar on 28 September 2021 (original question)
Question raised: If the custom field is sent with the full value, it has no problems and synchronizes it correctly. However, sometimes the value is not fully sent, so it generates the following error:
Script was taken from:
https://docs.idalko.com/exalate/display/ED/Syncing+cascading+select+custom+fields
//check if at least one option value exists and sync only existing values
def sourceRegion = replica.customFields."Custom Field"?.value?.parent?.value
def sourceCountry = replica.customFields."Custom Field"?.value?.child?.value
def region = nodeHelper.getOption(
issue,
"Custom Field",
sourceRegion
)
def country = region.childOptions.find
{it.value == sourceCountry}
if ( region != null && (sourceCountry == null || country != null)) {
issue.customFields."Custom Field"?.value = nodeHelper.getCascadingSelect(
region,
country
)
} else if (sourceRegion == null) {
issue.customFields."Custom Field"?.value = null
}
Any suggestions?
Comments:
Ariel Aguilar commented on 28 September 2021
You can check this line:
def region = nodeHelper.getOption(
issue,
"Custom Field",
sourceRegion
)
So, when fetching the option for region it can return null because is not found.
def region = nodeHelper.getOption(
issue,
"Custom Field",
sourceRegion
)
if (region == null) {
debug.error ("Region is missing an argument")
}
Kind regards,
Ariel