I have defined a variable within the email template and want to use that variable in velocity script. So, I am not sure about that email variable can be used in velocity or not?
Email Variable -
Email variable name is email_variable
<meta class="mktoString" id="email_variable" mktoname="Button Link" default="mylink" mktomodulescope="true" />
Velocity Script code is
#if( $ObjectList.isEmpty() )
<a href="http://www.mywebsite.com?parameter=${email_variable}">read more</a>
#end
Business Goal- To enable email local variable edit section in Email when variable is used in VTL coding.
Solved! Go to Solution.
Suggested method to use two velocity variable one in template level that will help to control the output but my purpose is to allow edit the variable value in email level as it offer when we create local variable in email template.
Although, velocity token can control output but not allow to edit variable at email level. To edit velocity variable value need to change the velocity token value each time which I want to avoid this limitations here.
It doesn't sound like you fully understood the setup.
The template would look like this:
{{my.beginConditionalOutputOrComment}}
<a href="http://www.mywebsite.com?parameter=${email_variable}">read more</a>
{{my.endConditionalOutputOrComment}}
This is actually a springboard to the much more advanced method I use myself, but you have to be an expert Velocity developer to implement and support that method in production.
Sorry, variables can't be used in this way.
Hi San,
May be my application is wrong. Could you please suggest possible way to achieve this business goal? or it has no options at all.
You could have two Velocity {{my.tokens}} (one with the the #if and one with the #end) on either side of the variable in the template.
Velocity thus doesn't need to read the variable itself but still controls the output.
Suggested method to use two velocity variable one in template level that will help to control the output but my purpose is to allow edit the variable value in email level as it offer when we create local variable in email template.
Although, velocity token can control output but not allow to edit variable at email level. To edit velocity variable value need to change the velocity token value each time which I want to avoid this limitations here.
Suggested method to use two velocity variable one in template level that will help to control the output but my purpose is to allow edit the variable value in email level as it offer when we create local variable in email template.
Although, velocity token can control output but not allow to edit variable at email level. To edit velocity variable value need to change the velocity token value each time which I want to avoid this limitations here.
It doesn't sound like you fully understood the setup.
The template would look like this:
{{my.beginConditionalOutputOrComment}}
<a href="http://www.mywebsite.com?parameter=${email_variable}">read more</a>
{{my.endConditionalOutputOrComment}}
This is actually a springboard to the much more advanced method I use myself, but you have to be an expert Velocity developer to implement and support that method in production.
Thanks San! but, it seems to be someone has to be more expertise in VTL. Kindly, share any reference link to understand in depth with similar scenario.
The method we're discussing here isn't written up separately anywhere. I write about Velocity topics on the blog, but also need to spend time on Marketo Forms JS and other areas to not have to narrow a focus. Eventually it'll all be dumped there.
I'm also working on a video training series for Velocity which will start from the beginner level and work up to at least this level. But there's no ETA on that... my new camera hasn't even arrived!
Also, in September at MOPsCON 2020 I'll be giving a talk on advanced content generation using Velocity, so you could sign up for that, but I don't think there's a site for it yet.
Wish you best of luck, Happy to see you in MOPsCON 2020!!!😊
is the registration link are open now?
I will love to join and read advanced content management method when you published it I will subscribe the blog.