15 Replies Latest reply on Jul 26, 2017 12:56 PM by Sanford Whiteman

    Velocity scripting - How to store multiple variables in a single token?

      Hi there,

       

      For each email I'm creating I have multiple email scripts because the CTA link, hero image, etc. all depend on variables (in my case the user's city)

      Is it possible to store all of this in one single token instead of having one token per variable I need?

      What I'd like to do is something like:

       

      #if(${lead.City} == "Montréal")
        #set( $thisButtonCityLinkEn = "http://www.yellowpages.ca/pl/loc/montreal-qc")
        #set( $thisButtonCityLinkFr = "http://www.pagesjaunes.ca/pl/loc/montreal-qc")
        #set( $thisHeroImage = "bla bla Montreal Hero bla bla")
        #set( $thisCleanCity = "Montreal")
      #elseif(${lead.City} == "Toronto")
        #set( $thisButtonCityLinkEn = "http://www.yellowpages.ca/pl/loc/toronto-on")
        #set( $thisButtonCityLinkFr = "http://www.pagesjaunes.ca/pl/loc/toronto-on")
        #set( $thisHeroImage = "bla bla Toronto Hero bla bla")
        #set( $thisCleanCity = "Toronto")
      #end
      

       

      And then from the inside of the email I would like to be able to call the 4 different variables I need for each email. Is this possible or does each Email Script return only 1 value? Or perhaps an array of values?

       

      Thanks,

       

      Thomas