Hello friends!
Another Velocity Script question for you all ✍️ This one feels like it might be silly and that I already know the answer, but would love validation!
My Strategic Events Team is looking to do Know Before You Go emails for our upcoming event and they want to include a variety of modules/sections in the email that would populate based on specific data e.g. whether someone has purchased a workshop or a guest pass for one of the parties, if they signed up for certifications etc. This would allow us to send registrants a single email with whatever information is applicable to them vs a separate email for each qualification.
❓If I use multiple velocity scripts in each email broken down by information type, is it safe to assume that those scripts will run independently of one another? Or is there a risk of them conflicting with one another or causing a race condition of sorts?
Appreciate any information or things to consider if we go this route!
Michelle 🙏
Solved! Go to Solution.
You absolutely can have multiple Velocity {{my.tokens}} in one email!
It's the only way to stay sane when using complex logic: you have tokens that store macros, others that do filtering, others that do output. Would be impossible to use Velocity effective otherwise, imo.
However, they do not run “independently.” All tokens share the same scope, so a $variable
declared/updated in one token affects all subsequent code, which runs from top to bottom. Really a Marketo email can be thought of as one continuous Velocity token!
You absolutely can have multiple Velocity {{my.tokens}} in one email!
It's the only way to stay sane when using complex logic: you have tokens that store macros, others that do filtering, others that do output. Would be impossible to use Velocity effective otherwise, imo.
However, they do not run “independently.” All tokens share the same scope, so a $variable
declared/updated in one token affects all subsequent code, which runs from top to bottom. Really a Marketo email can be thought of as one continuous Velocity token!
Thanks for the clarification and validation @SanfordWhiteman!
That makes sense about multiple scripts working independently - I would expect the tokens to share the same scope across whichever scripts are in the email; I was concerned that they would interfere with one another in some other way simply by running, and if that's not an issue, then wonderful!
This would definitely help me identify people much more easily and serve up the content that's applicable to them, so will see if I can get categories and content ASAP for testing and practice (all these use cases are building my experience with VS!).
As always, I appreciate your expertise and help 😀
Michelle