Velocity script - List multiple values create different output for each single choice and if two or more choices are selected
Hi @Sanford Whiteman
I'm trying to get this script to work. I need a condition for if two choices are selected you get a different output:
Here is my code:
#set( $outputBysubscriptionFunction = [
{
"pattern" : "(?i).*\b(144322355954892&&187699601952849)\b.*",
"greeting" : "Choices 1 and 2"
},
{
"pattern" : "(?i).*\b(187699601952849)\b.*",
"greeting" : "Choice 1"
},
{
"pattern" : "(?i).*\b(144322355954892)\b.*",
"greeting" : "Choice 2"
}
] )
#foreach( $outputSet in $outputBysubscriptionFunction )
#if( $lead.NL_Subscriptions__c.matches($outputSet.pattern) )
#set( $matchedOutputSet = $outputSet )
#break
#end
#end
<span>${matchedOutputSet.greeting}</span>
The result I'm getting is Choice 2 for when two choices are selected. Am I close? What am I missing?