Ticket custom fields and user fields
回答済みHey there,
I'm currently looking to store the clients phone number while creating a new request. I didn't find any option regarding this matter in the Forms/Fields, only for email field that is added automatically in the form when the user is not signed in. Is there a way to save this phone number custom field inside the user profile contact details information automatically ? Currently our agents have to copy the number from the custom field in the ticket to the user profile.
Thanks !
-
Hi Carlos ! This is certainly possible. A similar setup is located in this comment but below is a setup specific to your situation.
Create a webhook that points to the user endpoint
- Go to Zendesk Suite -> Admin Center -> Apps and integrations -> Webhooks -> Webhooks
- Create a new webhook with the following paramaters:
Name: Memorable name that uniquely identifies the webhook
Endpoint URL: https://subdomain.zendesk.com/api/v2/users/{{ticket.requester.id}}.json
Request method: GET
Request format: JSON
Authentication: Whichever you use. For API, we generally use Basic Authentication with username@domain.com/token for the user, and your API token for the password
- Test and create the webhook
Create a custom ticket field (if not done already)
- Go to Zendesk Suite -> Admin Center -> Objects and rules -> Tickets -> Fields
- Create a new custom field to capture the phone number (use numeric or text - I'd recommend numeric)
- Create field
- Copy down the custom field ID
- Add the custom field to your ticket form(s)
Create a trigger that writes the phone number on ticket creation
- Go to Zendesk Suite -> Admin Center -> Objects and rules -> Business rules -> Triggers
- Click on Add Trigger
- Set the appropriate conditions for your trigger (such as Ticket = Created and Form = Your_Form_Here)
- Under Actions, specify the following:
Type or select actions: Notify active webhook
Select the webhook you created earlier for the user endpoint
JSON body:
{
"user": {
"phone": "{{ticket.ticket_field_replacewithcustomfieldID}}"
}
} - Save trigger
Now, test it out and it should send the phone number captured in your custom field to the user profile!
-
Just one note there.
On step 2, the Request method should be PUT instead of GET.API Reference / Ticketing / Users / #Update User
PUT /api/v2/users/{user_id}
Also, this might fail if you have Validate user phone numbers enabled, as the phone numbers will have to be on the E.164 format
-
Thank you very much guys, both answers complement each other and of course it worked !
-
Hi! I have a similar situation where I went to get a piece of information from the user profile and insert it into the custom field on the ticket. In this example would I change it to "Get" and put in the custom ticket ID of the field from the user profile instead of the custom ticket field ID? Do I need to add a step to get the user profile field to populate in the custom ticket field? Any help would be greatly appreciated!!
-
Hi Ashley,
Is the info on the user profile in a custom user field with a tag value? If so, the ticket can inherit this tag from the user automatically so that it is present on the ticket. That would vastly reduce the effort needed to add the info to the ticket.
-
I have the same problem and it would be nice, to have a better solution than at the moment possible.
Regards
Sylvia
-
Hi, Sylvia!
Have you tried implementing the solution shared earlier in this thread? I'd be happy to help out if there's any particular areas that are giving you trouble.
Thanks,
Tipene
-
Hi! I have a similar situation as Ashley. I want to add the users external_id to a custom field (customer no). The updating of the custom field (customer no) with the solution in this thread works great, but how do I get the users external_id into the custom fields 'value' in the JSON? Any help would be very much appreciated!
{
"ticket": {
"custom_fields": [
{
"id": 360020980097,
"value": Here I need to pass the users external_id...but how?
}
]
}
} -
Hey Bjorn Spruijt,
You can use the "{{ticket.requester.external_id}}" placeholder for the value. So, the JSON payload of your trigger should look something like this:
{
"ticket": {
"custom_fields": [
{
"id": 360020980097,
"value": "{{ticket.requester.external_id}}"
}
]
}
}One thing to be aware of with this workflow is the potential for race conditions occurring when updating a ticket via trigger and webhook. Here's an article which goes in to more detail:
Can I use a trigger and a webhook to update tickets?I hope this helps!
Tipene
-
Great, thanks a lot for helping out and I understand!! I tried to acquire the external_id in my home-page template to pass it as a parameter as default field value for the customer no. in a form, but that didn't work since the ticket object doesn't exist in the home-page template and it seems that using the trigger and webhook is the only way to go...
サインインしてコメントを残してください。
10 コメント