Dynamic date token for email | Community
Skip to main content
March 21, 2016
Solved

Dynamic date token for email

  • March 21, 2016
  • 2 replies
  • 8795 views

Hi, we send out a sales email with different deadline dates and would like to create a dynamic date token that automatically updates this field. For example, we would like to have one token that uses “today's date” + 5 days and another token that uses “today’s date” + 7 days. Is there a way to easily set this up right from the token field?

Thanks!

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by Jason_Hamilton1

your email script tokens would look something like this

for 5 days

#set($dateInFiveDays = $date.calendar)

$dateInFiveDays.add(10,120)

$date.format('full_date',$dateInFiveDays.time)

and like this

for 7days

#set($dateInSevenDays = $date.calendar)

$dateInSevenDays.add(10,168)

$date.format('full_date',$dateInSevenDays.time)

The key value is the 120 and 168 (24hrs x number of days), You would also create two seperate tokens.

Make sense?

2 replies

Grégoire_Miche2
Level 10
March 21, 2016

Hi Carly,

You will need custom lead fields so that you can set their values and then use these fields in your email. To set the 2 values, just use "{{system.date}} + 5 days" (written exactly as is) or "{{system.date}} + 7 days" as new values in a Change Data Value flow step.

so if you create 2 custom lead fields (FutureDate1 and FutureDate2), you will be able to run a flow:

  1. Change data value. Attribute: FutureDate1, new value: {{system.date}} + 5 days
  2. Change data value. Attribute: FutureDate2, new value: {{system.date}} + 7 days
  3. Send email (email using the 2 fields)

-Greg

March 22, 2016

Hi Greg,

Thanks for your help, this will definitely be a good solution for us. I actually created a test campaign using a Change Data Value flow step and found that it populated the field with {{system.date}} + 5 days (see screenshot). I also tried writing it out without including "days" to see if that would fix the problem but it still just had + 5 in the date.

Jason_Hamilton1
Level 6
March 22, 2016

Are the custom fields of the type date?

Jason_Hamilton1
Level 6
March 22, 2016

I think you could also achieve this via an email script token, but Greg's solution is most likely easier to execute if you have not done any email scripting.

Jason

March 22, 2016

Hi Jason,

Do you know how to set this up? We use email script tokens already for some of our custom fields but I couldn't figure out how to do this with a date. Thanks!

Jason_Hamilton1
Jason_Hamilton1Accepted solution
Level 6
March 22, 2016

your email script tokens would look something like this

for 5 days

#set($dateInFiveDays = $date.calendar)

$dateInFiveDays.add(10,120)

$date.format('full_date',$dateInFiveDays.time)

and like this

for 7days

#set($dateInSevenDays = $date.calendar)

$dateInSevenDays.add(10,168)

$date.format('full_date',$dateInSevenDays.time)

The key value is the 120 and 168 (24hrs x number of days), You would also create two seperate tokens.

Make sense?