Velocity Script Not Populating In Email
Edited: Includes additional comment as a postscript.
Hello Community,
I am working on reusing some Velocity Script in a token that my team used last year for our industry event Abandoned Registration email/process; after updating only the dynamic content within it (I didn't change any of the parameters or fields), the script isn't working in my test emails or when I use a person to preview the email in Marketo.
I'm extremely unfamiliar with VS so would love some expert eyeballs on the script to see what's wrong (hoping it's an errant space or comma 😛). However, as I'm writing this, I see that there are a few () missing in various places - would inconsistencies with things like that cause the entire script to fail/break?
For example:
- Should there be a closing bracket at the end of lines like this?: #elseif ($lead.Support_Type__c.equals("Gold Success Plan")
- Should there be an opening bracket at the start of lines like this?: $lead.Public_Sector_Subsegment__c.equals("SLED - Higher Ed - ENT")
Here's the script that I'm using - from a function perspective, the various elements look to be correct (#elseif, #output etc) based on what I've read online (one article that I referenced) so I'm assuming it's these missing brackets or some errant space/character that I've yet to identify:
## Determines discount offering based on audience targeting segments
#if ($lead.NPO_Classification__c.equals("Approved"))
##output
<strong>A special discount just for you</strong>
As a nonprofit, your organization gets <strong>five free Oktane Standard passes</strong> (register using your .org email address).
#elseif ($lead.Support_Type__c.equals("Gold Success Plan") || $lead.Support_Type__c.equals("Premier Plus") || $lead.Support_Type__c.equals("Premier Plus Support") || $lead.Support_Type__c.equals("Premier Plus Success") || $lead.Support_Type__c.equals("Premier Plus Success Package") || $lead.Support_Type__c.equals("Courtesy Premier Plus"))
##output
<strong>A special discount just for you</strong>
Your organization qualifies for up to <strong>six free Oktane Standard passes</strong> (and, 50% off additional passes) because of your Premier Success Plan. When you register, just apply your discount code (contact your CSM to get it, if you haven't yet) on the “checkout” page.
#elseif ($lead.Support_Type__c.equals("Silver Success Plan"))
##output
<strong>A special discount just for you</strong>
Your organization qualifies for <strong>one free Oktane Standard pass</strong> (and, 30% off additional passes) because of your Premier Success Plan. When you register, just apply your discount code (contact your CSM to get it, if you haven't yet) on the “checkout” page.
#elseif ($lead.Support_Type__c.equals("Premier Access Success"))
##output
<strong>A special discount just for you</strong>
Your organization qualifies for<strong>50% off Oktane Standard passes</strong> because of your Premier Success Plan. When you register, just apply your discount code (contact your CSM to get it, if you haven't yet) on the “checkout” page.
#elseif ($lead.Support_Type__c.equals("Premier") || $lead.Support_Type__c.equals("Premier Success Package") || $lead.Support_Type__c.equals("Premier Support") || $lead.Support_Type__c.equals("Premier Success"))
##output
<strong>A special discount just for you</strong>
Your organization qualifies for <strong>30% off Oktane Standard passes</strong> because of your Premier Success Plan. When you register, just apply your unique discount code (contact your CSM to get it, if you haven't yet) on the “checkout” page.
#elseif ($lead.Account_Owner_Sales_Segment__c.equals("Federal") ||
($lead.Account_Owner_Sales_Segment__c.equals("Public Sector") &&
($lead.Public_Sector_Subsegment__c.equals("Federal - Civilian") || $lead.Public_Sector_Subsegment__c.equals("Federal - Other")) ||
($lead.MatchedAccount_Public_Sector_Subsegment__c.equals("Federal - Civilian") || $lead.MatchedAccount_Public_Sector_Subsegment__c.equals("Federal - Other"))) ||
($lead.Primary_Industry__c_lead.equals("Government") || $lead.Primary_Industry__c.equals("Government")))
##output
<strong>A special discount just for you</strong>
As a Public Sector org, you get <strong>20% off</strong> the current price for each Oktane Standard pass you purchase (register using a .gov, .edu, .mil email).
#elseif ($lead.Account_Owner_Sales_Segment__c.equals("SLED") ||
($lead.Account_Owner_Sales_Segment__c.equals("Public Sector") &&
($lead.Public_Sector_Subsegment__c.equals("SLED - Higher Ed - CML") ||
$lead.Public_Sector_Subsegment__c.equals("SLED - Higher Ed - ENT") ||
$lead.Public_Sector_Subsegment__c.equals("SLED - Local Government - CML") ||
$lead.Public_Sector_Subsegment__c.equals("SLED - Local Government - ENT") ||
$lead.Public_Sector_Subsegment__c.equals("SLED - Lower Education - CML") ||
$lead.Public_Sector_Subsegment__c.equals("SLED - Lower Education - ENT") ||
$lead.Public_Sector_Subsegment__c.equals("SLED - State") ||
$lead.Public_Sector_Subsegment__c.equals("EMEA - Public Sector") ||
$lead.Public_Sector_Subsegment__c.equals("EMEA - Central Gov") ||
$lead.Public_Sector_Subsegment__c.equals("SLED - Higher Ed - CML") ||
$lead.Public_Sector_Subsegment__c.equals("EMEA - Local Gov") || $lead.Public_Sector_Subsegment__c.equals("EMEA - Healthcare")) ||
($lead.MatchedAccount_Public_Sector_Subsegment__c.equals("SLED - Higher Ed - CML") ||
$lead.MatchedAccount_Public_Sector_Subsegment__c.equals("SLED - Higher Ed - ENT") ||
$lead.MatchedAccount_Public_Sector_Subsegment__c.equals("SLED - Local Government - CML") ||
$lead.MatchedAccount_Public_Sector_Subsegment__c.equals("SLED - Local Government - ENT") ||
$lead.MatchedAccount_Public_Sector_Subsegment__c.equals("SLED - Lower Education - CML") ||
$lead.MatchedAccount_Public_Sector_Subsegment__c.equals("SLED - Lower Education - ENT") ||
$lead.MatchedAccount_Public_Sector_Subsegment__c.equals("SLED - State") ||
$lead.MatchedAccount_Public_Sector_Subsegment__c.equals("EMEA - Public Sector") ||
$lead.MatchedAccount_Public_Sector_Subsegment__c.equals("EMEA - Central Gov") ||
$lead.MatchedAccount_Public_Sector_Subsegment__c.equals("EMEA - Local Gov") ||
$lead.MatchedAccount_Public_Sector_Subsegment__c.equals("EMEA - Healthcare"))) ||
($lead.Primary_Industry__c_lead.equals("Education") || $lead.Primary_Industry__c.equals("Education")))
##output
<strong>A special discount just for you</strong>
As a Public Sector org, you get <strong>20% off</strong> the current price for each Oktane Standard pass you purchase (register using a .gov, .edu, .mil email).
#end
This is how the editor looks:

This is how the preview/test email looks (when previewing with a person that meets the criteria for one of the groups in the VS):

Any help/direction/insight is always appreciated (as is validation that my assumption is right - I'm fiddling with the script on my end as we speak!).
TIA 😊
Michelle
PS. Just made all those changes in the script and when I went to send a test, I got this error - however, I can't see the details of it (not to mention the spelling error in it 🤣) so I don't know what the actual issue is or how to fix it:
Error Message

Edited script:
## Determines discount offering based on audience targeting segments
#if ($lead.NPO_Classification__c.equals("Approved"))
##output
<strong>A special discount just for you</strong>
As a nonprofit, your organization gets <strong>five free Oktane Standard passes</strong> (register using your .org email address).
#elseif ($lead.Support_Type__c.equals("Gold Success Plan”)) || $lead.Support_Type__c.equals("Premier Plus”)) || ($lead.Support_Type__c.equals("Premier Plus Support”)) || ($lead.Support_Type__c.equals("Premier Plus Success”)) || ($lead.Support_Type__c.equals("Premier Plus Success Package”)) || ($lead.Support_Type__c.equals("Courtesy Premier Plus"))
##output
<strong>A special discount just for you</strong>
Your organization qualifies for up to <strong>six free Oktane Standard passes</strong> (and, 50% off additional passes) because of your Premier Success Plan. When you register, just apply your discount code (contact your CSM to get it, if you haven't yet) on the “checkout” page.
#elseif ($lead.Support_Type__c.equals("Silver Success Plan"))
##output
<strong>A special discount just for you</strong>
Your organization qualifies for <strong>one free Oktane Standard pass</strong> (and, 30% off additional passes) because of your Premier Success Plan. When you register, just apply your discount code (contact your CSM to get it, if you haven't yet) on the “checkout” page.
#elseif ($lead.Support_Type__c.equals("Premier Access Success"))
##output
<strong>A special discount just for you</strong>
Your organization qualifies for<strong>50% off Oktane Standard passes</strong> because of your Premier Success Plan. When you register, just apply your discount code (contact your CSM to get it, if you haven't yet) on the “checkout” page.
#elseif ($lead.Support_Type__c.equals("Premier”)) || ($lead.Support_Type__c.equals("Premier Success Package”)) || ($lead.Support_Type__c.equals("Premier Support”)) || ($lead.Support_Type__c.equals("Premier Success"))
##output
<strong>A special discount just for you</strong>
Your organization qualifies for <strong>30% off Oktane Standard passes</strong> because of your Premier Success Plan. When you register, just apply your unique discount code (contact your CSM to get it, if you haven't yet) on the “checkout” page.
#elseif ($lead.Account_Owner_Sales_Segment__c.equals("Federal”)) ||
($lead.Account_Owner_Sales_Segment__c.equals("Public Sector”)) &&
($lead.Public_Sector_Subsegment__c.equals("Federal - Civilian”)) || ($lead.Public_Sector_Subsegment__c.equals("Federal - Other")) ||
($lead.MatchedAccount_Public_Sector_Subsegment__c.equals("Federal - Civilian”)) || ($lead.MatchedAccount_Public_Sector_Subsegment__c.equals("Federal - Other")) ||
($lead.Primary_Industry__c_lead.equals("Government”)) || ($lead.Primary_Industry__c.equals("Government"))
##output
<strong>A special discount just for you</strong>
As a Public Sector org, you get <strong>20% off</strong> the current price for each Oktane Standard pass you purchase (register using a .gov, .edu, .mil email).
#elseif ($lead.Account_Owner_Sales_Segment__c.equals("SLED”)) ||
($lead.Account_Owner_Sales_Segment__c.equals("Public Sector”)) &&
($lead.Public_Sector_Subsegment__c.equals("SLED - Higher Ed - CML”)) ||
($lead.Public_Sector_Subsegment__c.equals("SLED - Higher Ed - ENT”)) ||
($lead.Public_Sector_Subsegment__c.equals("SLED - Local Government - CML”)) ||
($lead.Public_Sector_Subsegment__c.equals("SLED - Local Government - ENT”)) ||
($lead.Public_Sector_Subsegment__c.equals("SLED - Lower Education - CML”)) ||
($lead.Public_Sector_Subsegment__c.equals("SLED - Lower Education - ENT”)) ||
($lead.Public_Sector_Subsegment__c.equals("SLED - State”)) ||
($lead.Public_Sector_Subsegment__c.equals("EMEA - Public Sector”)) ||
($lead.Public_Sector_Subsegment__c.equals("EMEA - Central Gov”)) ||
($lead.Public_Sector_Subsegment__c.equals("SLED - Higher Ed - CML”)) ||
($lead.Public_Sector_Subsegment__c.equals("EMEA - Local Gov”)) || ($lead.Public_Sector_Subsegment__c.equals("EMEA - Healthcare")) ||
($lead.MatchedAccount_Public_Sector_Subsegment__c.equals("SLED - Higher Ed - CML”)) ||
($lead.MatchedAccount_Public_Sector_Subsegment__c.equals("SLED - Higher Ed - ENT”)) ||
($lead.MatchedAccount_Public_Sector_Subsegment__c.equals("SLED - Local Government - CML”)) ||
($lead.MatchedAccount_Public_Sector_Subsegment__c.equals("SLED - Local Government - ENT”)) ||
($lead.MatchedAccount_Public_Sector_Subsegment__c.equals("SLED - Lower Education - CML”)) ||
($lead.MatchedAccount_Public_Sector_Subsegment__c.equals("SLED - Lower Education - ENT”)) ||
($lead.MatchedAccount_Public_Sector_Subsegment__c.equals("SLED - State”)) ||
($lead.MatchedAccount_Public_Sector_Subsegment__c.equals("EMEA - Public Sector”)) ||
($lead.MatchedAccount_Public_Sector_Subsegment__c.equals("EMEA - Central Gov”)) ||
($lead.MatchedAccount_Public_Sector_Subsegment__c.equals("EMEA - Local Gov”)) ||
($lead.MatchedAccount_Public_Sector_Subsegment__c.equals("EMEA - Healthcare")) ||
($lead.Primary_Industry__c_lead.equals("Education”)) || ($lead.Primary_Industry__c.equals("Education"))
##output
<strong>A special discount just for you</strong>
As a Public Sector org, you get <strong>20% off</strong> the current price for each Oktane Standard pass you purchase (register using a .gov, .edu, .mil email).
#end
