Marketo displaying multiple dates in Custom Token
Greetings Marketo Community,
We wanted to send an email to customers that open a loan with us letting them know when their first payment is due. When a customer opens an account (regardless of the type of account) it is logged as a CO named HasCCUAccount. I wrote code that pulls the next due date, since this is what we want to inform them of.
However, upon testing the email, I noticed that if a customer has several HasCCUAccount COs with a loan product attached to it and blank "Next Due Date" fields, it automatically applies the actual next due date three times.

The code I used to pull the Next Due Date is below.
#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 = "yyyy-MM-dd" )
#set( $ISO8601DateOnlyMonthFirst = "MM-dd-yyyy" )
#set( $ISO8601DateTime = "yyyy-MM-dd'T'HH:mm:ss" )
#set( $ISO8601DateTimeWithSpace = "yyyy-MM-dd HH:mm:ss" )
#set( $ISO8601DateTimeWithMillisUTC = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'" )
#set( $ISO8601DateTimeWithMillisTZ = "yyyy-MM-dd'T'HH:mm:ss.SSSZ" )
#set( $interestingProduct = ["USED LEND PRO INC","NEW LEND PRO INC","NEW AUTO ALTERN WIS","MOTORCYCLE WIS IND","REC VEHICLE WIS IND","USED AUTO WIS IND","NEW AUTO WIS IND","MOTORCYCLE ILL IND","REC VEHICLE ILL IND","USED AUTO ILL IND","NEW AUTO ILL IND","NEW AUTO CE12","SECURED OTHER GOODS CE12","REC VEHICLE OE","SECURED OTHER GOODS OE","PCU USED VEHICLE","PCU USED VEHICLE JR MEETING","PCU NEW VEHICLE","NEW AUTO ALTERN IL","USED AUTO ALTERN IL","USED AUTO ALTERN WI","USED AUTO OE","NEW AUTO OE","MOTORCYCLE CE12","REC VEHICLE CE12"] )
#foreach( $account in $cCUAccount_cList )
#if( $interestingProduct.contains($account.product) )
#set( $nextDueDateFormatted = $convert.toCalendar(
$convert.parseDate(
$account.nextDueDate,
$ISO8601DateTimeWithSpace,
$defaultLocale,
$defaultTimeZone
)
))
${date.format(
$ISO8601DateOnlyMonthFirst,
$nextDueDateFormatted,
$defaultLocale,
$defaultTimeZone
)}
#end
#end
Is there a code that I can apply to ensure that it does not pull loan products with blank "Next Due Date" fields? Thanks in advance for any help that can be provided.
Best,
Lucas
