Re: Velocity Date Manipulation

Anonymous
Not applicable

Velocity Date Manipulation

I've got a few date tokens that I've reworked using Velocity, but there are a few issues, the most troubling of which is that the script succeeds in the Marketo email previewer but fails when I send a test email containing it. Look:
 
  1. Parse date to make it manipulable.
    1. #set ($x = ${convert.parseDate($lead.DATEFIELD,"MMM d',' yyyy")})
  2. Compare dates.
    1. $date.difference($x,$date)

This works in the previewer. When I send an email containing anything above, however, I get the script and not its output. I've even tried $convert.toString($x), but that hasn't worked.
 
Can anyone shed some light on what's going on? Thanks!
Tags (1)
2 REPLIES 2
Anonymous
Not applicable

Re: Velocity Date Manipulation

Hi Wyatt,

passing the date value in a variable and then converting it to a date has compiled properly in my tests.

#set($x = ${lead.DATEFIELD})
<p>Unformatted: $x</p>
#set($x = ${convert.parseDate($x, 'yyyy-MM-dd')})
<p>Converted: $x
<br>
$date.difference($x,$date)
</p>
 
$date.whenIs($x).full
Anonymous
Not applicable

Re: Velocity Date Manipulation

I had an issue like this and it turned out I hadn't check the box in the column on the right of the script editor next to the field I was using.