10 Replies Latest reply on Dec 7, 2016 12:52 PM by Vibha Rao

    Velocity Scripting - make lowercase

    Vibha Rao



      So I wrote the following velocity script to make a token value to appear in lower case in the email copy:

      1. #set ($ptier = ${lead.Partner_Tier__c.toLowerCase()})


        Am using this as a token {{my.Previous_Partner_Tier1}} in my email copy.


      2. #set ($pptier = ${lead.Previous_Partner_Tier__c.toLowerCase()})


        Token that I am using in email copy {{my.Previous_Partner_Tier1}}


      Yesterday - I did couple of sample tests of the email and it all worked fine.


      Today its not working, the tokens are not getting populated with value and are appearing as {{my.Previous_Partner_Tier1}} in the copy itself. Would you know if anything has changed in the velocity email scripting side that I need to update in the script above? or am I missing something?

        • Re: Velocity Scripting - make lowercase
          Sanford Whiteman

          First, your code isn't doing what you're saying it's doing.  It's not lowercasing, it's lowercasing and then capitalizing the first letter.


          Second, you're saying you've named the two Velocity scripts the same: {{my.Previous_Partner_Tier1}}. This is not possible. The same name cannot refer to two scripts at the same time. If you're overriding the token at a lower level of the tree, that's still only one available script by that name.


          (Also, don't use ${formal} syntax in #set statements unless you need to. Makes the code harder to read. And please use the code highlighting/formatting ability of this forum.)