Hi All,
I'm getting frustrated with velocity scripting in Marketo!
So I'm building a template that includes a velocity script to show some segments of the email depending on one of the leads boolean values (in this case a tick box)
Here is an example of the code I'm trying to create:
#if (${lead.iASNewsletterGrowth} == "0")
(Some HTML content)
#end
#if (${lead.iASNewsletterGrowth} == "1")
(Some HTML content)
#end
Now the problem is that instead of showing one or the other depending on the lead's info, it's simply not showing either shouldn't this be impossible?
Any help would be great, please see the attached full HTML file for reference.
Thanks,
Simao
Hi Simao,
You cannot add velocity scripting to a template as you did. You will have to create a program, and in this program, create a velocity token, and add you code to it. Then, in the template of the email, you will be able to insert this token, under the form of {{my.velocitytoken}}
-Greg
I'm gutted... I just can't believe it's not possible. I'll take your word for it though, I'm just disappointed that we can't make dynamic templates.
Any workaround that you think Gregorie?
Thanks,
Simao
Yes, the alternative in Marketo is call dynamic content. It's done at email level, and does not require any coding
-Greg
PS: My first name is either Greg or Gregoire, not Gregorie.
I just can't believe it's not possible. I'll take your word for it though, I'm just disappointed that we can't make dynamic templates.
It's not exactly that you can't add Velocity token references to templates, putting the dynamism at the template level. I do this all the time.
It's that the {{my.token}} needs to correspond to a token in the Marketing Activities Folder/Program tree, like Greg said.
Thus, either the email that's based on the template needs to be in a Program, or a Campaign that references the email needs to be in a Program. This isn't unique to Velocity: it it applies to other {{my.tokens}} as well.
I used to think this was the case myself. However, I recently decided that I should actually test this out and it seems that you can totally create an email in the design studio and have it run custom my.tokens from the program level. Based on this finding, I think the campaign that is used to generate the send is the controller in that sense, but I could be wrong as that's just a guess for now. Regardless, the email doesn't actually have to live in the program.
The issue is that sending samples won't work. You'll need to actually execute a campaign that lives in the program as the campaign will control how the email consumes tokens.
I'm glad to hear thoughts on this.
Yep, it's true that the separate sending campaign location determines the {{my.tokens}} in that case. But the tokens still need to exist in Marketing Activities: it's not possible to have the whole thing in Design Studio. I'll edit my answer to be more precise.