Pulling data from 40 days in future Velocity Token from Custom Object

Ajay_mamgain15
Level 1

Pulling data from 40 days in future Velocity Token from Custom Object

Hi,

 

I'm getting blank values from a velocity token that I wrote last year and it was working fine at that point in time however now it's just giving me blank data. The logic is we need to look for the value from a custom object list where fixedRateExpiryDate which is a future date matches 40 days from now and the value which we need is maskedBBAN if the status is active. I don't know if there's an update from Marketo which caused this issue however it was indeed working fine. Would appreciate any help. @SanfordWhiteman 

#set( $defaultTimeZone = $date.getTimeZone().getTimeZone("Pacific/Auckland") )
#set( $defaultLocale = $date.getLocale() )
#set( $calNow = $date.getCalendar() )
#set( $ret = $calNow.setTimeZone($defaultTimeZone) )
#set( $calConst = $field.in($calNow) )
#set( $ISO8601DateOnly = "yyyy-MM-dd" )
#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( $fixedRateItems = [] )
#foreach( $item in $customerProductsONLY_cList )
#if( $item.accountStatus.equals("Active") && $item.fixedRateExpiryDate && $item.maskedBBAN)
#set( $void = $fixedRateItems.add($item.maskedBBAN) )

#set ($maskredBBANFormat = $item.maskedBBAN)

#set( $ret = $calNow.set(
   $calNow.get($calConst.YEAR),
   $calNow.get($calConst.MONTH),
   $calNow.get($calConst.DAY_OF_MONTH),
   0,
   0,
   0
) )

#set( $ret = $calNow.set($calConst.MILLISECOND,0) )
#set( $nextExpiryDate = $convert.toCalendar(
  $convert.parseDate(
    $item.fixedRateExpiryDate, 
    $ISO8601DateOnly, 
    $defaultLocale, 
    $defaultTimeZone 
  )
) )

#set( $daystoexpire =$date.difference($calNow,$nextExpiryDate).getDays())
##change number of days below
#if($daystoexpire == 40)

<li>$maskredBBANFormat##</li>
#else

#end
#end
#end

 velocity.PNG

5 REPLIES 5
SanfordWhiteman
Level 10 - Community Moderator

Re: Pulling data from 40 days in future Velocity Token from Custom Object

Please also supply the raw output of

${customerProductsONLY_cList}

for a relevant lead.

Ajay_mamgain15
Level 1

Re: Pulling data from 40 days in future Velocity Token from Custom Object

Ajay_mamgain15_0-1661359854112.png

list.PNG

 

Thanks for the reply @SanfordWhiteman I'm getting the value if i include the list. Luckily in the lead, there was only one active case but in others, we might have a list of multiple entries and we only need 1 from the list which matches the logic.

SanfordWhiteman
Level 10 - Community Moderator

Re: Pulling data from 40 days in future Velocity Token from Custom Object


Ajay_mamgain15_0-1661359854112.png

Thanks for the reply @SanfordWhiteman I'm getting the value if i include the list. Luckily in the lead, there was only one active case but in others, we might have a list of multiple entries and we only need 1 from the list which matches the logic.


Don’t understand what you mean by “... if I include the list.”

 

Need to see an example of a person for whom the code is giving unexpected results. And the raw contents of the CO list for that person.

Ajay_mamgain15
Level 1

Re: Pulling data from 40 days in future Velocity Token from Custom Object

Can you share the script to display all CO? I remembered in one of the posts you showed how to troubleshoot the Velocity script but I'm not able to find it. Also, I'm using Sample send do you think I need to send the actual email instead for testing?

SanfordWhiteman
Level 10 - Community Moderator

Re: Pulling data from 40 days in future Velocity Token from Custom Object


Can you share the script to display all CO?

To display the entire list (though not with datatypes, and not in a very pretty format) just do:

${WhateverList_c}

 

You definitely have to use a real email. Don’t use Samples to test Velocity.