Hi there,
We are experiencing an issue with email script tokens in our emails. We are pulling date information from Salesforce opportunity records and using email script tokens to populate the dates in renewal notification emails to our customers. The dates are pulling in and formatted correctly upon send. However, the dates that render in the emails are 5 days behind the actual dates on the opportunity in Salesforce (e.g. Salesforce Opportunity Date Field=12/05/2020 & Marketo email token=November 30, 2020) This is also happening with other date fields populated in the email body from a Salesforce opportunity. Why is this happening and how do to we fix this?
Here is the script I am using to format the date properly. I am guessing there is something incorrectly coded in this script, but I cannot determine which line of code might be changing the date results. Any help is very much appreciated!
#set($RenewalDate = $date.format("yyyy-MM-dd", ${OpportunityList.get(0).Renewal_Date__c}))
#set( $defaultTimeZone = $date.getTimeZone().getTimeZone("America/New_York") )
#set( $defaultLocale = $date.getLocale() )
#set( $calNow = $date.getCalendar() )
#set( $ret = $calNow.setTimeZone($defaultTimeZone) )
#set( $calConst = $field.in($calNow) )
#set( $ISO8601DateOnly = "MM-dd-yyyy" )
#set( $ISO8601DateTime = "MM-dd-yyyy'T'HH:mm:ss" )
#set( $ISO8601DateTimeWithSpace = "MM-dd-yyyy HH:mm:ss" )
#set( $ISO8601DateTimeWithMillisUTC = "MM-dd-yyyy'T'HH:mm:ss.SSSZ" )
$calNow.add($calConst.DATE,60)
#set( ${OpportunityList.get(0).Renewal_Date__c} = "MMM dd, yyyy" )
${date.format(
${OpportunityList.get(0).Renewal_Date__c},
$calNow,
$defaultLocale,
$defaultTimeZone
)}
... View more