Hello,
We have an issue with field to which html code is populated and then referred in Velocity Script.
Everything worked fine till Friday April 23rd 21' when it stopped and essentialy all characters "<" and ">" are disrupting our code and when email is populated in Preview whe see pure html code where there should be regular email content.
We are using option HTML Encode checked on a field level.
Also tried solutions described in here: https://nation.marketo.com/t5/Product-Blogs/Even-when-Velocity-isn-t-doing-anything-it-s-doing-somet... but still no luck.
Our dev suggested workaround and use something like within the Velocity token:
#set ($valueCC = "${lead.commoditiesBulletinContentOil}")
$valueCC.toString().replaceAll("\<\;","<").replaceAll("\>\;",">");
but then there are some   left
I would appreciate any help here.
Best,
Kacper
Solved! Go to Solution.
Yes, in the 2 instances I tested that had the bug, it was fixed tonight — while I was working on the bug report.
This is the same bug (and the same code???) one of your coworkers reported elsewhere, I believe. Have since confirmed it in another Marketo instance, but not on 2 others.
You don't need a regex here. This will do:
#macro( unescapeHTML_v1 $escaped )
#set( $unescaped = $escaped.replace("<","<").replace(">",">").replace("&","&") )
${unescaped}
#end
Put that in a Velocity token included at the top of the email.
Then call it using
#unescapeHTML_v1($lead.commoditiesBulletinContentOil)
etc.
Thanks Sanford!
It works to some point but it duplicates content somehow. I re-checked if each token (set-up per each field) refers to the correct field so eliminated scenario when something is duplicated:
Do you think there is something I am missing?
Thanks,
Kacper
@Kacper_Gawlik @Anthony_Figgin1 I've been looking into this further and — unless it's been partially fixed in the interim — is it possible the bug only existed in Preview (which is still a bug) but not in the actual received email? That's the behavior I'm seeing now.
@SanfordWhiteman Just as an FYI, I've experienced problems with html (directly from a lead token though, no velocity involved) not rendering properly in the Preview but working just fine in the actual email. Like Kacper, the issue started around Friday (23rd) but seems to have been fixed now. (Ashburn instance)
Thank you All for your swift help and support!