10 Replies Latest reply on Aug 6, 2018 9:15 PM by Adele Grono

    Velocity Script - value range

    Adele Grono

      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