AnsweredAssumed Answered

Using velocity script to pull data from custom object based on a time period.

Question asked by Cindy Menorath on Mar 21, 2019
Latest reply on Mar 21, 2019 by Sanford Whiteman

Hi,

I'm building out a dynamic email that should render content for members after a specific anniversary date, which is from a custom object data.

I can code it to match up with a specific date value using the equal operator, but it does not work with the greater then or less then operator. I'm trying to code it for "After" or "Before" a specific date.

 

Here is a sample code that works if we use equal operator:

 

#foreach($partner in $partner_cList)

#set ($AnniversaryDate = $date.toDate("yyyy-MM-dd", ${partner.enrollmentEndDate}))

#set ($Date1 = $date.toDate("yyyy-MM-dd", "2019-10-01"))

#set ($Date2 = $date.toDate("yyyy-MM-dd", "2019-10-30"))

 

#if($AnniversaryDate >= $Date1)

 

show this content

 

#break

#else

#end

Outcomes