Originally asked by Tomas Vaitkevicius on 30 January 2024 (original question)
Hello, does someone maybe know how to sync Jira “Select List (Multiple Choice)” => Zendesk “multi-select dropdown”?
I found a similar case here ZD to Jira - multiselect dropdown Sync(old community) that works well but would also need a solution that works the other way around Jira “Select List (Multiple Choice)” => Zendesk “multi-select dropdown”
The mapping should happen based on Jira value to Zendesk value (tag).
I would appreciate it if someone could help!
Comments:
Javier Pozuelo commented on 31 January 2024
Hello Tomas,
I will be working on the solution for this and will be updating you as soon as possible.
// Jira value title : ZD tag
def companyMap = [
“Company 1”: “t_f_company_1”,
“Company 2”: “t_f_company_2”,
“Company 3”: “t_f_company_3”,
“Company 4”: “t_f_company_4”
]
// Check if the Jira issue has the ‘Company’ field populated
def companyField = replica.customFields.“Company”
if (companyField&&companyField.value) {
// Retrieve ‘value’ property from ‘Company’ field in Jira
def jiraCompanyValues =companyField.value
// Map Jira company values to ZD company values using the defined mapping
def zendeskCompanyValues = jiraCompanyValues.collect { companyObject ->
companyMap[companyObject.value] ?: companyObject.value
}.findAll { it != null } // Filter out null values
// Update ZD company field in current issue, ZD company field is referenced by ticket field ID 55555555
issue.customFields.“55555555”.value = zendeskCompanyValues
} else {
// If ‘Company’ field is not populated or doesn’t exist, set Zendesk company field to null
issue.customFields.“55555555”.value = null
}
Comments:
Javier Pozuelo commented on 31 January 2024
Hi Tomas,
I’m glad you figured it out. Thanks for providing the answer!