date field with custom object to add if loop
I have the following code, which formats date exactly the way I need it.
The issue is I only want to show the date in email which matches correct $eventid for customers.
I tried this loop but nothing populates:
#foreach( $eventid in $oN24Attendee_cList )
#if( $eventid.equals("2862094") )
$eventdatetime_formatted
#end
#end
----------------
Full code
## get the size of the list of Custom object
## remove one from the size of the list to reference the right object in the array (arrays start at zero, not 1)
#set( $lastIndex = $math.sub($listlength,1) )
## convert the Service Start Date string to a date
#set( $dateOptions = {
"formats" : {
"userin" : "yyyy-MM-dd hh:mm",
"userout" : "dd MMMM yyyy hh:mm a"
},
"timezones" : {
"userin" : "America/Chicago",
"userout" : "Europe/London"
},
"locale" : $date.getLocale()
} )
#set( $eventdatetimelike = $oN24Attendee_cList.get($lastIndex).eventdatetime )
#set( $eventdatetime = $convert.parseDate(
$eventdatetimelike,
$dateOptions.formats.userin,
$dateOptions.locale,
$date.getTimeZone().getTimeZone($dateOptions.timezones.userin)
) )
## convert the date to a different format
#set( $eventdatetime_formatted = $date.format(
$dateOptions.formats.userout,
$eventdatetime,
$dateOptions.locale,
$date.getTimeZone().getTimeZone($dateOptions.timezones.userout)
) )
#foreach( $eventid in $oN24Attendee_cList )
#if( $eventid.equals("2862094") )
$eventdatetime_formatted
#end
#end