Hi community,
since Zendesk seems to be far from an, in my opinion, normal customer service application, I need to script a solution, which just doesn't work, and due to a lack of, for me, understandable documentation, I cannot figure out where it goes wrong.
We are an online shop with customer service via Zendesk, and we need to get customer account numbers synced. There are primary keys in our ERP software and shop, but both are not connected to Zendesk.
I want to achieve, that if the account number is entered in a ticket, but not present in the user (customer), to write it to the customer field as well.
On the other hand, if we know the user (customer) and his/her account number, we will write it into the ticket account number field for quick reference, in case it is blank.
User:
custom field called "Kundennummer" with key "kundennummer"
Ticket:
custom field called "Kundennummer" with ID "********3817"
I have set two http-targets:
The first "pointing" to {{ticket.id}}.json:

The second to {{ticket.requester.id}}.json:

Also, I have set two triggers:
The first syncs the customer number from the user field to the ticket. Conditions are: [Status<closed] + [ticket.kundennummer = not available] + [user.kundennummer = available] (and to only affect test tickets for now: [group = management], as well as [status = changed] OR [status = new] to trigger.
Code for JSON is:
{
"ticket": {
"custom_fields": [{
"id": ********3817, "value": "{{ticket.requester.custom_fields.kundennummer}}"
}]
}
}
The second syncs the customer number back from ticket to user, if the user doesn't already have a number. The trigger does pretty much the same, with inverted customer null values, uses the other http-target (though I have tried with the "sync to ticket" target as well) and this code:
{
"user": {
"custom_fields": {
"kundennummer": "{{ticket.ticket_field_********3817}}"
}
}
}
I also have pretty much tried every way of putting this, but the documentation seems to spare this usage of user custom fields completely, not telling me what exact structure and syntax I need to use here to hit the user custom field with title "Kundennummer" and key "kundennummer".
I tried to hit the field, e.g., with the following and some more:
- ticket.requester.custom_fields.kundennummer
- ticket.requester.user_fields.kundennummer
- ticket.user.user_fields.kundennummer
- ticket.user.custom_fields.kundennummer
and variations including [{"key": "kundennummer", "value": "{{variable}}"}] and such
The first trigger hits every time flawlessly, syncing user "kundennummer" to ticket "kundennummer".
The second trigger never works.
What am I doing wrong here?
Thanks for sharing the solution here Brandon!