Hi there
The Velocity Script below selects the default value even if the record selected contains one of the values in the script.
Any advice on what code to change?
Many thanks
## Set up your map of xyz to related asset(s)
#set( $assetsBycourseCode = {
"5428AB" : {"IND" : "blue"},
"4410AS" : {"IND" : "green"},
"4418PM" : {"IND" : "yellow"},
"3409ES" : {"IND" : "red"},
"" : {
"IND" : "default text"
}
} )
##
## Start w/default asset set (empty key)
#set( $assets = $assetsBycourseCode[""] )
##
## Guard against bad inputs (null or empty object list)
#foreach( $assetSet in $assetsBycourseCode )
## If we find a regex match for [map key,CourseCode] we're done
#if($lead.courseCode.matches("(?i)${assetSet}") )
#set( $assets = $assetsBycourseCode[$assetSet] )
#break
#end
#end
${assets.IND}
Sanford Whiteman
Solved! Go to Solution.
On the right-hand-side of Script Editor, there's a tree of all the Person, Opportunity, and Custom Object fields. A field must be checked off there if it's going to be used in Velocity. For a very good reason -- memory conservation -- fields are not automatically exported into the Velocity context, they need to be manually selected.