7 Replies Latest reply on Mar 31, 2017 7:26 AM by Osman Erzinclioglu

    Tool for writing and validating Velocity scripts?

    Osman Erzinclioglu

      Can anyone suggest a good tool for writing and validating Velocity scripts? I had a plugin for Eclipse IDE, but I lost it when I switched PCs, so I'm not sure which one I used. (Also, I'm not very familiar with Eclipse and remember having spent a lot of time trying to get it working.)


      A token we created some time ago has started exhibiting strange behaviour and because it's a velocity script, we're on our own with respect to troubleshooting.


      We haven't changed it in any way, but it's no longer functioning correctly within some of our templates.


      Any insight into that would be helpful as well – why a token might function correctly in one e-mail template but not another. (Using the same leads under the same program with the same tokens.)


      Rather than render the value from the lead's field, Marketo is spitting out the name of the variable from the token as a string. That is, something like ${lead.Wholesaler_name__c} rather than the e-mail address that appears in the lead's "Wholesaler Name" field. (But only in some templates and not in others.)

        • Re: Tool for writing and validating Velocity scripts?
          Sanford Whiteman

          Eclipse is kinda the way to go, since it can also execute Velocity scripts (though of course you have to provide a test context). A few other editors have VTL syntax highlighting but that's about it. My Velocity lab is simple but critical... thought I had a hard drive crash the other day and was freaking out about a restore!


          Running Velocity scripts outside of Marketo can give maybe 98% confidence that the same script will work in Marketo, but not 100%, due to quirks of the platform.  (In fairness, that's about the same coverage you get from testing in the Marketo UI vs. sending a real email... there's always the need for that last triple-check.)


          As for the same token functioning differently in different templates, that only makes sense if it depends on an earlier token (I use global tokens in the <head> for example, which set up global variables). Or, in reverse, if an earlier token overwrites the $lead object, that would mean the property is not found and so the literal variable name is printed.


          If you want to hit me up I'm sure we can figure it out.

          2 of 2 people found this helpful
          • Re: Tool for writing and validating Velocity scripts?
            Osman Erzinclioglu

            Okay. Embarrassing outcome. The issue was related to fields not being flagged on within the tokens. What I don't understand is, those tokens had been working for ages and suddenly stopped. (Or I've gone completely insane.)


            I'd still like to get Eclipse set up again so that I can better test my scripts, but there's no urgency now.


            Thanks, Sanford, for your help – and apologies for wasting your time.

              • Re: Tool for writing and validating Velocity scripts?
                Sanford Whiteman

                Cool... that's what I would've looked at first.


                My only guess would be maybe someone rebuilt (copied and pasted) the tokens without thinking about the fields being checked off.

                  • Re: Tool for writing and validating Velocity scripts?
                    Osman Erzinclioglu

                    There are a few tokens that are part of a set. I definitely edited some of them recently, but the ones which I mentioned here hadn't been edited for a long time – at least by me. Tried looking through the audit trail, but there's no specific option, as far as I can see, to look at changes to tokens alone, so it's hard to tell whether there were changes. It doesn't look like there's anything recent. (In the last couple of days when the problems cropped up.)


                    Really confused by this because I had been using those myself and wasn't having any issues. I'm definitely missing something.


                    I guess I felt confident that those variables were flagged on since I had been using the tokens without issue. I should definitely put together a checklist for myself on these things so I go about my troubleshooting more systematically.


                    Thanks again, Sanford, for the help!