Automatically adding calendar events to tickets (advanced)

Using Zendesk triggers, you're already able to set a date on a ticket X number of days in the future. However, one of the limitations of Zendesk triggers is that you're not able to update custom text fields. Since the calendar time and timezone are text fields, that means it's not possible to automatically set the time of the event right? Well no. It's not as easy as it could be (it's a little advanced), but it is still possible. 

STEP 1: The target

The first step is to setup an HTTP target. To do this first click on the cog on the left of the screen, then scroll to the bottom and click on "Extensions". Then at the top right click on "add target" like this:


Select HTTP target from the list:


Name it "Update ticket". 

For the URL add in this:{{}}.json

(Replace yourhelpdesk with the name of your help desk)'

Set the method to "PUT"

...and the content type to "JSON"

Finally, tick the box to enable credentials and enter in your Zendesk credentials... it should look like this when you're done: 

Note: If you're using SSO on your desk, you will not be able to use your regular username and password. Instead, you will need to enter your username with /token at the end like this: and for the password, you will need to generate an API token - see here for more


Once you're happy to go ahead and create the target.


STEP 2: Getting the ticket field ID's

In order to set the ticket fields in the trigger, we're going to need the ticket field ID's. However, since they've been created by the app you're not able to access those ID's the normal way. So we'll need to search for them. You can do this by going to this URL:

(Replace yourhelpdesk with the name of your help desk)'

Then do a search (ctrl + f) for the 'calendar' ticket fields and make a note of the IDs for the following calendar fields:

Calendar event time

Calendar event time zone

Calendar name

Calendar event duration (in minutes)


You may see the information above displayed a little differently, but all you need is the IDs so once you find them, make a note of them and head back to the agent interface. 

STEP 3: Getting the exact calendar name & timezone.

In order to know what to set the calendar name and timezone, you will need to check what's currently being used on a ticket. 

To do this create a test ticket in Zendesk and manually add a calendar event. 

Then check the events log of the ticket and you should see something like this:


Note that there is an ID associated with any calendar name that you will need to copy as part of the name eg. "Support (1022)" as above.


For the timezone, an alternative way to get the acceptable timezone values is here:


Time Format: Note that the time format in the image above is HH:MM (ie. 14:30) ie. time should be set to 24-hour format. So if you wanted to set the time for anything before 10 am, say 8:30 AM, the correct value to use in for time will be "08:30". Do not forget to place a zero in front of the 8 or it will not be treated as a valid format.


STEP 4: Creating the trigger

To create the trigger that will automatically add the calendar event in the future click on the cog on the left of the screen, then click on triggers, finally click on 'add trigger' at the top right-hand side like this: 


Under "Meet all of the following conditions" you can put in whatever rules are required for the workflow you're trying to achieve. 

Under "Perform these actions" add the rules:

# "Ticket: Calendar Date" - "Set to a number of days from now" - "[Enter the number of days you want]"

# "Notifications: Notify target" - "Update ticket" 

In the JSON body add this code: 

"ticket": {
"custom_fields": [{"id": 45844587, "value":"09:00"},{"id": 45844607, "value":"Melbourne"},{"id": 45844547, "value":"Support (1022)"},{"id": 45844627, "value":"60"}]

Replace the ID's listed above with the ID's you noted in step 2. Also set the value "Melbourne" to your timezone and the name of the calendar to match yours.

When you're done it should look something like this: 


Finally, click on "Create trigger" at the bottom right-hand side and test it out. 

Was this article helpful?
2 out of 2 found this helpful



Please sign in to leave a comment.