Velocity directly in template modules | Community
Skip to main content
Jo_Pitts1
Community Advisor
Community Advisor
February 19, 2020
Question

Velocity directly in template modules

  • February 19, 2020
  • 1 reply
  • 3489 views

Good afternoon all.

is it possible to write velocity code directly against a module in an email template, or do I need to abstract it by referencing a script token in the template?  

I'd like to build out a module that has the ability to comment itself out (often referenced here) without needing to add tokens in the email itself, and am curious as to best practice.

Cheers

Jo

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.

1 reply

SanfordWhiteman
Level 10
February 19, 2020

It is possible to write a limited amount of VTL directly in a template (this is the reason that there are reserved words in templates). However, this is in no way supported, and I advise as strongly as possible that you not rely on it.

 

If you want to conditionally comment out a section, you should wrap it in Velocity {{my.token}}s.

Jo_Pitts1
Community Advisor
Jo_Pitts1Community AdvisorAuthor
Community Advisor
February 19, 2020

Makes sense (and yes, I was already predicting problems with reserved characters).

 

Next silly question - can module variables be referenced in Velocity.  E.g., I set the a variable called 'colour' to 'BLUE' on the module, and then depending on whether a lead has a checkbox 'loves_blue' checked leave the module on display, otherwise comment it out?

SanfordWhiteman
Level 10
February 19, 2020
Unfortunately not, those vars can't be used in VTL.