5 Replies Latest reply on Jan 16, 2018 8:42 PM by Sanford Whiteman

    My.Token Errors

    James Randolph

      I'm trying to write a velocity email script that takes the user's date and subtracts it by a fixed date (promo code expiration date).

       

      Here's my code so far:

       

      #set ($today = $convert.parseDate($date.getDate(), "yyyy-MM-dd")

      #set ($promoEnd = $convert.parseDate('2018-02-01', "yyyy-MM-dd"))

      #set ($result = $date.difference ($promoEnd, $today).days)

      #end

      When I test it out in an email, I get this error:

      "An error occurred when procesing the email Body! Encountered "#set" near" (followed by my code)

       

      Given that Marketo converts all data types to a string, I think I need to format the dates into a number in order to effectively call the date.difference method - but other than that I'm not sure what's going wrong.

       

      Any help would be appreciated, thanks!