1 answer
- 210
Hi,
I had a challenge in a similar scenario because the custom fields names were the same on both sides, but the options were different. I had to use ids instead of custom field names.
Below is along the lines of what I had to do. Please note that the 'L' is not a typo (at the end of "insert id of custom field on Destination side")
I'm not an expert, so apologies if this wastes your time!
def typeOfSupport = [
"Project Configuration" : "Project Configuration",
"User Management" : "User Management"
]
// type of support sync: lookup the source type of support and set on the destination side
def SourceSupport = (replica.customFields."Type of Support"?.value?.value) as String
def desiredTypeofSupport = typeOfSupport[SourceSupport]
if (!desiredTypeofSupport) { return }
issue.customFields."insert id of custom field on Destination side".value = nodeHelper.getOption(issue, insert id of custom field on Destination sideL, desiredTeam)
- Juan Grases
Nice answer, I wanted to make a small fix:
issue.customFields."insert id of custom field on Destination side".value = nodeHelper.getOption(issue, insert id of custom field on Destination sideL, desiredTeam)
Should actually be:
issue.customFields."insert id of custom field on Local side".value = nodeHelper.getOption(issue, insert id of custom field on Local sideL, desiredTeam)
Also I wanted to add, that in case that option values are the same on both sides you can simplify the approach by doing:
def SourceSupport = replica.customFields."Type of Support"?.value?.value def localSourceSupport = nodeHelper.getOption(issue, insert id of custom field on Local sideL, SourceSupport) issue.customFields."insert id of custom field on Local side".value = localSourceSupport
- Howard Kenny
So close!
Add your comment...
Hello,
In this example,
issue.customFields."Hobby".value = nodeHelper.getOption (issue, "Hobby", "Running")
This is configured for only one option "Running" but I want Whatever option I will select in source it will sync with destination.
Could you tell me the syntax for synchronization for below fields.
Example : Source Side
Field Name : Type of Support
Option Values : Project Configuration , User Management.
Destination Side:
Field Name : Type of Support
Option Values : Project Configuration , User Management, Add-On
Also what if both the options are different at source side and destination side.
Regards,
Neha Aggarwal