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:

Pluto_-_Agent.jpg

Select HTTP target from the list:

Pluto_-_Agent.jpg

Name it "Update ticket". 

For the URL add in this: https://yourhelpdesk.zendesk.com/api/v2/tickets/{{ticket.id}}.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: 

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:

https://yourhelpdesk.zendesk.com/api/v2/ticket_fields.json

(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. 

https___pluto_zendesk_com_api_v2_ticket_fields_json.jpg

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:

Pluto_-_Agent.jpg

 

Alternatively, you can check what the acceptable timezone values are here https://en.wikipedia.org/wiki/List_of_tz_database_time_zones

 

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: 

Pluto_-_Agent.jpg

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: 

Pluto_-_Agent.jpg

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

 

 

 

Have more questions? Submit a request

0 Comments

Please sign in to leave a comment.
Powered by Zendesk