9 Replies Latest reply on Oct 17, 2017 8:15 PM by 7c60e94d2e095adf531f410eb949245479fd7343

    Cannot apply string's functions to an output obtained from LEAD/CUSTOM objects

      Hi,

       

      I'm trying to split a string into parts using 'colon' as delimiter. Given $number = "10:20:30", I need to loop through the whole string and do something to each number in it, eg. output "10" then output "20" and then "30" and end the loop. My code reads:

       

      #set ($numberSet = "10:20:30")

      #foreach ($number in $numberSet.split("[:]"))

      $number

      #end

       

      ------------------

      OUTPUT:

      10 20 30

      ------------------

       

      which works fine. However, if I try to obtain the value from LEAD/CUSTOM objects (which has the exact same value), the code will read:

       

      #set ($numberSet = "{{lead.numberSet:default=edit me}}")

      #foreach ($number in $numberSet.split("[:]"))

      $number

      #end

      ------------------

      OUTPUT:

      10:20:30

      ------------------

       

      From above, the split() function will not work. It isn't just split() function but any other string's function won't be working at all (replace, substring). I tried getClass() and its output was "class java.lang.String". Despite the output showing it is string type, no string's functions I can apply with it.

       

      So essentially, I need to know how to deal with the value from LEAD/CUSTOM objects. Are they being treated as JSON? If so, how to get the context of the LEAD's variable (10:12:14) and store it to a variable and use string's functions with it.

       

      Thank you.