Check image of Zendesk ticket. The red field called âIncidentâ changes its count every time there is a new incident associated to this specific ticket
Answer by Francis Martens (Exalate) on 16 June 2021
Yes, you can.
Whenever something is missing in the Exalate API - you can always get to the REST exposed ticket information using the httpClient.
1) First step is to understand what the REST api is returning
Create a scripted connection
Add to the outgoing sync following code
ZENDESK - Outgoing
def related = httpClient.get("/api/v2/tickets/${ticket.id}/related")
debug.error("Result = ${related}")
Sync a Zendesk ticket
The debug.error will raise an error (which is intended) showing
Result = [ticket_related:[from_archive:false, url:https://d3v-francis.zendesk.com/api/v2/tickets/121/related.json, jira_issue_ids:[], incidents:3.0, followup_source_ids:[]]]
There you can see that the information returned by the call is a map with one entry âticket_relatedâ
ticket_related is a map with a couple of fields including âincidentsâ
2) With this knowledge in your backpack, you can now extract the incident information and add it to the replica
def related = httpClient.get("/api/v2/tickets/${ticket.id}/related")
replica.incidentCount = related?.ticket_related?.incidents
Make sure you use the safety operator in case the get returns nothing