I have hacked some code that you have posted in a different discussion but it is returning the default value rather than the value that matches the CourseCode on the Lead. Am I on the right track? I know this code originally related to a custom object. This is the code I am using and I expected to match on 5522US. ## Set up your map of Courses to related asset(s) #set( $assetsByCourse = { "5522US" : { "OCBURL" : " http://www.csu.edu.au/courses/bachelor-of-science-honours " }, "1105PP" : { "OCBURL" : " http://www.police.nsw.gov.au/recruitment/home " }, "" : { "OCBURL" : " http://www.csu.edu.au/courses " } } ) ## ## Start w/default asset set (empty key) #set( $assets = $assetsByCourse[""] ) ## ## Guard against bad inputs (null or empty object list) #if( $LeadList && !$LeadList.isEmpty() ) ## ## Loop backwards through objects (standard for each is fwd only) #foreach( $idx in [$math.sub($LeadList.size(),1)..0] ) #set( $Lead = $LeadList[$idx] ) #foreach( $assetSet in $assetsByCourse.keySet() ) ## ## If we find a regex match for [map key,CourseCode] we're done #if( $Lead.CourseCode.matches("(?i)${assetSet}") ) #set( $assets = $assetsByCourse[$assetSet] ) #break($foreach.parent) #end #end #end #end "${assets.OCBURL}"
... View more