Originally asked by Francis Martens (Exalate) on 17 May 2021 (original question)
The challenge is a follows
Whenever a ticket is created on behalf of a certain user, that certain user is added as a ‘cc’ user.
This customer would like to set this user as the reporter of the twin
On line 1 - httpClient is used to retrieve the email_ccs from the ticket. The ticket is identified with the ticket.id
On line 3 - test if the response contains a number of emails.
On line 4 - Note there can be multiple emails, this example is returning the first user returned by the Zendesk API
On line 6 and 7 - extract the information contained in the firstUser object (name and email)
On the other side (assume Jira) following logic can be applied to fill in a text field with a wiki renderer
Incoming sync - Jira
// fill custom field 'cc' in case the ccName and email are provided
if (replica.customKeys.ccName > "") {
issue.customFields.cc.value = "[${replica.customKeys.ccName}|mailto:${replica.customKeys.ccEmail}]"
}