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!
Solved! Go to Solution.
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?
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:
-Greg
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.
Are the custom fields of the type date?
Hi Carly,
Yes, Jason is right on this, your custom field type is string, likely. Set it to Date and it will work.
-Greg
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
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!
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?
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
Great thanks Jason, that is exactly what we need!