Recent searches
No recent searches
Email Trigger based on custom date field
Answered
Posted Dec 01, 2016
I would like to create an email trigger that will fire 14 days after a specific date that is in a custom date field. I have the logic for my trigger figured out besides this. Currently I do not see that option within the drop down for a custom date field (outlined in red).
Does anyone know of a good way to accomplish this seemingly simple task?
1
10
10 comments
Joel Hellman
Hi Travis, I can't of a simple way to do this either. Date and time based logic in Zendesk are in much need of improvements.
That said, I have a workaround you might consider using a second field holding the due date, a trigger (or an automation) and a HTTP target.
I'll just go through the parts specific to the dates, but you'll have to figure out how to modify the trigger/automation conditions yourself to suit your situation.
Using a second date field holding the due date
If you add another custom field that hold the due date, and initialize it when your first custom date field is set, you could then use a automation condition like this to fire off your automation like this:
(I use a larger value for days since its conceivable you'd have situations where you initialize the due date when it's already way due.)
Since Zendesk doesn't have calculated fields or business rule actions to do field calculations, you'd need something like a HTTP target to initialize this followup field based on the value of the delivery date field.
Making a HTTP Target to update tickets
Set up a HTTP target (Settings>Extensions>HTTP target) like this:
Url
The URL string should look like this:
For reference, you are setting up the target to work the REST API of Zendesk documented here: https://developer.zendesk.com/rest_api/docs/core/tickets#update-ticket
Credentials
You need to provide credentials when using a HTTP target to call Zendesk this way.
Use credentials either like:
or if you prefer to use an API token you have set up
Setup your trigger (or automation)
Next would be to setup a trigger or automation that activates your HTTP target to update a the ticket's second date field to the value of the first date field + 14 days.
First, find out your custom ticket IDs:
Let's say you have two fields like this (your IDs will differ):
Then the action part of the trigger should look like this:
We use Zendesk placeholders and liquid markup to calculate the second date value based of the first date value, and when the HTTP request is sent, the resulting JSON payload will looks like this:
Here is the JSON body to copy-paste:
(Modify the IDs in this example, so the ID in the id field refer to your Delivery Followup Date field, and the ID in the value field refer to your Delivery Date.)
Explanation of the liquid code for the value calculation
We only want set the followup date if the Delivery Date has a value, and if there is no Delivery date, there should be no followup date either.
Here we
Disclaimers
Using HTTP targets this way is not really supported by Zendesk, meaning you can do it, but if you need to troubleshoot you might have to do it yourself. HTTP targets are more meant to deliver information to 3rd party systems.
Using HTTP targets this way, you'll have no feedback when the targets fail. You might use the 'Test Target' option in the edit target page to check your target if it doesn't seem to work.
This is one way to do it using only Zendesk. The "proper" way to this kind of operation using a Zendesk trigger and HTTP target would be to point the target to a web service, and have that web service call back to Zendesk to update the ticket. Then you'd have logs, error handling etc.
The Zendesk agent interface is not always updated when a HTTP target fires in this way, or sometimes the update is delayed a bit. Reload the ticket if in doubt. This is only relevant if you actually show the ticket field in the ticket (if you are using ticket forms). You don't actually need to show the second date field to the ticket (i.e. in a form) for this to work.
This will only work if you are on an appropriate Zendesk plan where you have access to targets and custom triggers and liquid markup.
1
Joel Hellman
Here is how it might look in case you have the Delivery Date Followup field showing in the ticket.
Showing the field in the ticket is not necessary for the HTTP target or triggers/automations to work, though.
0
Travis Abdelhamed
Wow Joel, thank you for the detailed explanation! This is an incredible amount of effort to accomplish something so simple.
Hopefully there will be other solutions native to Zendesk
0
Joel Hellman
You're welcome. I agree with you, by the way :)
0
Joel Hellman
FYI: Travis made a feature request on this topic.
0
Andrew J
Have you looked at using the 'Task' Due date option instead? Of course this may not suit what you are doing.
It gives more options.
0
Andrew J
Also - we've been using the Sweethawk deadline app which is a very effective date app - once again may not suit your application.
0
Travis Abdelhamed
Thanks for the feedback Andrew!
0
Thomas D'Hoe
+1
0
Nicole Saunders
Hey Thomas -
Are you +1-ing the OP or one of the comments? Adding your +! by voting with the arrow buttons helps specify which thing you're responding to.
0