Sort by Topics, Resources
Clear
Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form.

Salto for

Zendesk

Articles

SHARE

How to format dynamic dates for your Zendesk macros and business rules

Jude Kriwald

September 26, 2023

4

min read

So far in this series (see Part 1 and Part 2 here), we’ve learned lots about inserting the exact dynamic date and time that we’re after. But what if we want the output to display differently? How do we go from “we’ll get back to you no later than 2023-06-28 16:00”, which is far too robotic, to “we’ll get back to you no later than Thursday by 4 pm”?

The answer is that Ruby, the language we’re using to tell Zendesk what to output, has many different options for how you’d like to format the date. In the below tables, I have provided a multitude of options for common date formats.

Experience the Ease & Confidence of NetSuite Customizations with Salto

What if Zendesk was 4x less work?

Request a Demo ≥

STAY UP TO DATE

Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form.

Subscribe to our newsletter to learn how to customize Zendesk and keep your agents happy

Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form.

This is a monthly email with educational content. No spam (we promise).

Formatting year, month, week, and day

You can use any of these date formatters in place of the existing ones in the examples I gave earlier on.

For example, you can replace the current date example I gave in Part 1:


String:


{{'now' | date:'%Y-%m-%d'}}

Output:

2023-06-23

To do this, we’d take out “%Y-%m-%d” and could replace them with “%A, %B %W”

To make {{'now' | date:'%A, %B %W'}}, which outputs like this: Friday, June 25. That’s much nicer to read for simple email correspondence.

Formatting hours and minutes

Just as with the dates, we can insert these time formatters into our string to display the date/time as we want our customers to see it. You can do this anywhere in between the two apostrophes of date:’’ and you can add other text within those two apostrophes too, to create the exact structure you want for your output.

For example, you could test this out by pasting the below into your comment editor on Zendesk and submitting the ticket:

The time now is {{'now' | date:'%l%p on %A'}}

Which creates this:

STAY UP TO DATE

Tips & tricks from Zendesk masters

Subscribe to our newsletter to learn how to customize Zendesk and keep your agents happy

Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form.

This is a monthly email with educational content. No spam (we promise).

Next-level auto-response

Using everything we’ve learned in this three-part series, we can now see how to achieve the customised auto-response that your customers receive when they contact your team.

From anywhere within Zendesk, click the four tiny squares in the top right of the Zendesk window > click Admin Centre > in the search bar on the left, type “triggers”. Alternatively, navigate to: https://YOURDOMAIN.zendesk.com/admin/objects-rules/rules/triggers/ . From there, you want to look for your auto-response trigger. By default, it would have been called Notify requester and CCs of received request, but you may have renamed it. 

Click on that trigger to open it up.

Unless you’ve modified this already, the Actions for this trigger will look like this:

Pretty dry, right? Let’s update the Email body with something much more personalised. I’m going to use the copy below, which you can copy in too, and then I’ll explain each placeholder or dynamic bit of text.

Hi {{ticket.requester.first_name}},

Thank you for your email. I just wanted to let you know that our team has received it safely. We’ll get back to you no later than {{ 'now' | date: '%s' | plus:266400| date: '%A by %l%P' }}.

I hope you have a wonderful day and we look forward to helping you soon.

Kind regards,

{{agent.first_name}},

{{ticket.brand.name}}

Let’s break this down a bit:

  • {{ticket.requester.first_name}} gives us the first name of the person who requested the ticket, normally your customer.

  • {{agent.first_name}} is the first name of the agent who answers the ticket

  • {{ticket.brand.name}} is the name of the brand in which the ticket sits. Whilst this setup is perfect for some, if you haven’t given your brands names that are intended to be seen by your consumers, it might be worth changing this.

  • {{ 'now' | date: '%s' | plus:266400| date: '%A by %l%P' }} is obviously the part we’ve been building up to. This string outputs today’s date plus three days and an hour, formatted in a human-friendly way, such as Monday by 5 pm.

  • The number you see in that string, 266,400, is three days plus one hour, expressed in seconds. This is so that if this email is sent to the customer at 16:30 on Friday, it doesn’t say they should receive a response by Monday at 4 pm, when in fact a three calendar-day SLA would give until Monday at 4:30 pm, half an hour later. Given that, for the sake of simplicity and clarity, we have chosen not to display minutes in our auto-response, we round up to add an extra hour and ensure that the customer will have received a response, assuming we hit our SLA, by the time we promise.

The output of this will look something like the below:

Hi Julia,

Thank you for your email. I just wanted to let you know that our team has received it safely. We’ll get back to you no later than Monday by 5 pm.

I hope you have a wonderful day and we look forward to helping you soon. 

Kind regards,

Jude Kriwald

My Brand Name

WRITTEN BY OUR EXPERT

Jude Kriwald

Zendesk Consultant

Jude Kriwald first learned to administer Zendesk in 2015 and has been helping businesses improve their customer operations as a freelance consultant since 2018. Offline, he can be found making maps, paragliding or exploring remote places.

Sort by Topics, Resources
Clear
Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form.

Salto for

Zendesk

Zendesk

SHARE

How to format dynamic dates for your Zendesk macros and business rules

Jude Kriwald

September 26, 2023

4

min read

So far in this series (see Part 1 and Part 2 here), we’ve learned lots about inserting the exact dynamic date and time that we’re after. But what if we want the output to display differently? How do we go from “we’ll get back to you no later than 2023-06-28 16:00”, which is far too robotic, to “we’ll get back to you no later than Thursday by 4 pm”?

The answer is that Ruby, the language we’re using to tell Zendesk what to output, has many different options for how you’d like to format the date. In the below tables, I have provided a multitude of options for common date formats.

What if Zendesk was 4x less work?

Request a Demo Get started with Salto

Formatting year, month, week, and day

You can use any of these date formatters in place of the existing ones in the examples I gave earlier on.

For example, you can replace the current date example I gave in Part 1:


String:


{{'now' | date:'%Y-%m-%d'}}

Output:

2023-06-23

To do this, we’d take out “%Y-%m-%d” and could replace them with “%A, %B %W”

To make {{'now' | date:'%A, %B %W'}}, which outputs like this: Friday, June 25. That’s much nicer to read for simple email correspondence.

Formatting hours and minutes

Just as with the dates, we can insert these time formatters into our string to display the date/time as we want our customers to see it. You can do this anywhere in between the two apostrophes of date:’’ and you can add other text within those two apostrophes too, to create the exact structure you want for your output.

For example, you could test this out by pasting the below into your comment editor on Zendesk and submitting the ticket:

The time now is {{'now' | date:'%l%p on %A'}}

Which creates this:

Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form.

Next-level auto-response

Using everything we’ve learned in this three-part series, we can now see how to achieve the customised auto-response that your customers receive when they contact your team.

From anywhere within Zendesk, click the four tiny squares in the top right of the Zendesk window > click Admin Centre > in the search bar on the left, type “triggers”. Alternatively, navigate to: https://YOURDOMAIN.zendesk.com/admin/objects-rules/rules/triggers/ . From there, you want to look for your auto-response trigger. By default, it would have been called Notify requester and CCs of received request, but you may have renamed it. 

Click on that trigger to open it up.

Unless you’ve modified this already, the Actions for this trigger will look like this:

Pretty dry, right? Let’s update the Email body with something much more personalised. I’m going to use the copy below, which you can copy in too, and then I’ll explain each placeholder or dynamic bit of text.

Hi {{ticket.requester.first_name}},

Thank you for your email. I just wanted to let you know that our team has received it safely. We’ll get back to you no later than {{ 'now' | date: '%s' | plus:266400| date: '%A by %l%P' }}.

I hope you have a wonderful day and we look forward to helping you soon.

Kind regards,

{{agent.first_name}},

{{ticket.brand.name}}

Let’s break this down a bit:

  • {{ticket.requester.first_name}} gives us the first name of the person who requested the ticket, normally your customer.

  • {{agent.first_name}} is the first name of the agent who answers the ticket

  • {{ticket.brand.name}} is the name of the brand in which the ticket sits. Whilst this setup is perfect for some, if you haven’t given your brands names that are intended to be seen by your consumers, it might be worth changing this.

  • {{ 'now' | date: '%s' | plus:266400| date: '%A by %l%P' }} is obviously the part we’ve been building up to. This string outputs today’s date plus three days and an hour, formatted in a human-friendly way, such as Monday by 5 pm.

  • The number you see in that string, 266,400, is three days plus one hour, expressed in seconds. This is so that if this email is sent to the customer at 16:30 on Friday, it doesn’t say they should receive a response by Monday at 4 pm, when in fact a three calendar-day SLA would give until Monday at 4:30 pm, half an hour later. Given that, for the sake of simplicity and clarity, we have chosen not to display minutes in our auto-response, we round up to add an extra hour and ensure that the customer will have received a response, assuming we hit our SLA, by the time we promise.

The output of this will look something like the below:

Hi Julia,

Thank you for your email. I just wanted to let you know that our team has received it safely. We’ll get back to you no later than Monday by 5 pm.

I hope you have a wonderful day and we look forward to helping you soon. 

Kind regards,

Jude Kriwald

My Brand Name

WRITTEN BY OUR EXPERT

Jude Kriwald

Zendesk Consultant

Jude Kriwald first learned to administer Zendesk in 2015 and has been helping businesses improve their customer operations as a freelance consultant since 2018. Offline, he can be found making maps, paragliding or exploring remote places.