3 Replies Latest reply on Jun 7, 2017 7:16 AM by Sanford Whiteman

    Velocity Script error - Change link by country

    Ian Shaw

      I'm completely new to Velocity scripting, hoping it can solve a problem I'm having.


      I want to serve up different links in an email based on what country is listed in a lead's record.  I do not want to use dynamic content/segmentation for this, as we'd use this link in lots of emails and I'd prefer not to have to set it up each time.  I took a script from another discussion and modified it as such:


      #set( $linksBLC = { 

        "United Kingdom" : "http://website.com/page2", 

        "United States" : "http://website.com/page3", 

        "*" : "http://website.com/page1


      #set( $link = $linksBLC[$lead.Country] ) 

      #if ( !$link ) 

        #set( $link = $linksBLC['*'] ) 


      <a href="$link">Click here</a>##

      This gives me the following error:


      Cannot get email content-

      An error occurred when procesing the email Rendered_Email_Velocity_Error_Area_?!




      Not the most helpful error, and turns up zero results in google.  Could someone let me know what I'm doing wrong?


      The list would eventually contain 60+ countries, just trying to get it working before I scale it.