Hi Dan,
Send yourself a sample using one of your preview leads. Script tokens won't render in preview mode (which is fairly worthless to begin with, IMO). Marketo has to actually run the script for it to insert anything and it will only do that when shooting an email out. Make sense?
The above error is the message I get when I try to send the sample:
An error occurred when procesing the email Body!
Lexical error, Encountered: "\u201c" (8220), after : "" at *unset*[line 200, column 239] near
</tr>
<tr>
<td style="background-color:#ffffff;padding-top:0;padding-bottom:0;padding-right:0;padding-left:0;border-collapse:collapse;">
<tab
Hi Dan. Your parenthesis seem out of whack.
You have:
$date.format('MMM dd, yyyy hh:mm tt', ${convert.parseDate(${lead.client_saintsseatrelocation}), 'yyyy-MM-dd HH:mm:ss')})
Try:
$date.format('MMM dd, yyyy hh:mm tt', ${convert.parseDate($lead.client_saintsseatrelocation, 'yyyy-MM-dd HH:mm:ss')})
Also, I'm not sure waht "tt" is. AM/PM is actually lowercase "aa" if that's what you're looking for.
Your error output looks like what it does when you forget to check the box next to the field in the script window. Are you sure the "lead.myvu_enrolled_date" field is checked?
It is checked (that is always frustrating to test something for an extended period of time only to realize the box was unchecked!). I have contacted support about this problem - this token in particular only works in samples, never as an alert.
Ryan,
How would you go about adding a week to a date stored in a variable?
Thanks
Hi Reed... I haven't quite mastered adding a date to a specific field... but I have come up with a way around it. Not sure if this will work in your situation but:
If my smart list is triggering off of a SFDC custom field "Purchase Date" being 5 days ago, I can use "Today" as the field to add to. So say I want to place a date in an email that is 20 days from the date they purchased, but I want to send the email 5 days after they purchased, I can just add 15 days to today's date and place it in the email with this scripted token:
#set($x = $date.calendar)
$x.add(5,15)
$date.format('EEEE, MMMM dd, yyyy',$x)
I'm determined to figure out how to add days to existing date fields.
Okay, well after trying the same thing for weeks, it finally worked:
#set($lead.ProspectDate = $date.calendar)
$lead.ProspectDate.add(5,36)
$date.format('EEEE, MMMM dd, yyyy',$lead.ProspectDate)
"36" is where you put how many days you want to add to the date. "5" represents that are you adding calendar days. Good luck!
Hey team
I'm trying something similar, but when I use the code given to Jim it's not working for me. Here's my code:
#set ($listlength = ${abandonedCart_cList.size()})
#set( $lastIndex = $math.sub($listlength,1) )
#set($str = $convert.parseDate(${abandonedCart_cList.get($lastIndex).serviceStartDate}, "yyyy-MM-dd HH:mm:ss"))
$date.format('medium',$str)
I only get the output $date.format('medium',$str) instead of the formatted date. Why? Those last two lines are identical to what seemed to be working above, just with my variables substituted in.
Any ideas?
Look for any of my posts where I show data parsing + display.