Automatically adding deadlines to tickets (advanced)

Using Zendesk triggers, you're already able to set a date field 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 deadline time and timezone are text fields, that means this is not possible to automatically set the time of the deadline 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

Step 2: Getting the ticket field ID's

Step 3: Getting the exact name of your timezone

Step 4: Creating the trigger



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 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, 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 screens 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 deadline ticket fields and make a note the Deadline time ID and the Deadline timezone ID. 


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


Step 3: Getting the exact name of your time zone.

In order to know what to set the 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 deadline event manually. 

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



Alternatively, you can check what the acceptable timezone values are here


Time Format: Note that the time format in the image above is 14:00 (HH:MM) 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 due date 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: 


Give the trigger a name like "Automatically set deadline on ticket X days from now".

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

Under "Actions" add the rules:

# "Ticket: Deadline 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": 49021128, "value":"09:00"},{"id": 49021148,"value":"Australia/Melbourne"}]

Replace the ID's listed above with the ID's you noted in step 2. Also set the value "Australia/Melbourne" to your timezone.

When you're done, the 'Actions' part of the trigger should look something like this: 


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




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



Please sign in to leave a comment.