Incorrect value displayed in token
Hi all,
I'm attempting to troubleshoot a token that was scripted before I started out. Basically, it's displaying the wrong value, though IT says our CRM is talking to Marketo correctly.
Here is the script I'm working with for the token, checking eligibility for a particular program:
## find closest future appointment
## begin selection logic
#set($matchedAppt = false)
#foreach($appt in ${appointment_cList})
#set($matchedApptDate = false)
#set($currentApptDate = $date.toDate('yyyy-M-d', $appt.appointmentDate))
#set($currentApptOffset = $date.difference($date, $currentApptDate).getMilliseconds())
## if appointment is in future
#if($currentApptOffset > 0 && $appt.orderType == 'LLS')
## first match
#if(! $matchedAppt)
#set($matchedAppt = $appt)
## nth match
#elseif($matchedAppt)
#set($matchedApptDate = $date.toDate('yyyy-M-d', $matchedAppt.appointmentDate))
#end
##endif match
## if comparable
#if($currentApptDate && $matchedApptDate)
#set($difference = $date.difference($currentApptDate, $matchedApptDate).getMilliseconds())
## current closer than existing match
#if($difference > 0)
#set($matchedAppt = $appt)
#end
#end
##endif comparable
#end
##endif future
#end
##endfor
## end selection logic
## begin usage
#if($matchedAppt)
#if($matchedAppt.aWVCheckDeligibility == "Y")
<span>CONFIRMED</span>##
#elseif($matchedAppt.aWVCheckDeligibility == "N")
<span>NOT YET CONFIRMED</span>##
#end
#else
<span>UNKNOWN</span>
#end
When I send myself sample emails, for a lead that should be reading as "CONFIRMED," I'm getting "NOT YET CONFIRMED." I'm guessing there may be an error in the syntax somewhere, but I'm so new to Velocity scripting that I have no idea how to find it. Any thoughts on what might be going on here?
Also, for what it's worth, the fields referenced here are part of a custom object, which I'm not as familiar with. I'm used to doing tokens based on custom fields only. I'm guessing the 'Appt' bit is the object, since that's called "Appointment."
Apologies if I am clear as mud here, and thank you for your help. ![]()