Tokens Pulling Multiple Custom Object Information
We are noticing an issue where the tokens used to pull a badgeID are pulling in data from the custom object from the two past years rather than just the most recent year as defined in the token.
I've tried to use .get(0) to pull only the most recent entry in the custom object, but I haven't been successful. Below is the code that I have tried to do this based on reading other posts and trying to piece something together.
##begin lopping through Contact List
#foreach($event in $Contact_Event__cList)
##retrieve event name and registration type
#set ($name = ${Contact_Event__cList.get(0).Event_Name__c})
#set ($regType = ${event.Registration_Type__c})
##name: $name <br>
##regType: $regType <br>
##check if $year matches designated year
#if( ($name == "2017") && ($regType == "EO") || ($regType == "P") )
${event.Badge_ID__c}
##end if statement
#end
##close the loop
#end
Below is how the custom object is set up:

Thank you!
Juli