SOLVED

Dynamic date token for email

Go to solution
Anonymous
Not applicable

Dynamic date token for email

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!

Tags (3)
1 ACCEPTED SOLUTION

Accepted Solutions
Jason_Hamilton1
Level 8 - Champion Alumni

Re: Dynamic date token for email

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?

View solution in original post

10 REPLIES 10
Grégoire_Miche2
Level 10

Re: Dynamic date token for email

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

Anonymous
Not applicable

Re: Dynamic date token for email

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.

dynamic date token error.PNG

Jason_Hamilton1
Level 8 - Champion Alumni

Re: Dynamic date token for email

Are the custom fields of the type date?

Grégoire_Miche2
Level 10

Re: Dynamic date token for email

Hi Carly,

Yes, Jason is right on this, your custom field type is string, likely. Set it to Date and it will work.

-Greg

Jason_Hamilton1
Level 8 - Champion Alumni

Re: Dynamic date token for email

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

Anonymous
Not applicable

Re: Dynamic date token for email

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
Level 8 - Champion Alumni

Re: Dynamic date token for email

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?

Jason_Hamilton1
Level 8 - Champion Alumni

Re: Dynamic date token for email

The thing to note here is that the value is not being stored anywhere in the db, just written to the email at the time of the send, not sure if that was what you were looking for.

Jason

Anonymous
Not applicable

Re: Dynamic date token for email

Great thanks Jason, that is exactly what we need!