Avatar

Level 2

Hi There

 

I have a requirement where a I need to add some html blocks to the email template based on the value of some attributes that are populated in the delivery workflow. I have a simple javascript code in the HTML template using an AND condition (&&) but the ampersands are being escaped after saving the template and they are converted into &

 

Original code snippet:

<tbody><!-- BEGIN DYNAMIC CONTENT BLOCKS --> <%if(targetData.recommendations1.ocidLink != '' && targetData.recommendations2.ocidLink != '') { %>

 

After saving the template and re-opening it:

<tbody><!-- BEGIN DYNAMIC CONTENT BLOCKS --> <%if(targetData.recommendations1.ocidLink != '' &amp;&amp; targetData.recommendations2.ocidLink != '') { %>

 

When I run the workflow with that template the delivery fails as the code snippet is broken due to the && code being escaped.

 

I also tried to embed the code in a <script> tag, but upon saving the template and close it Adobe Campaign deletes the <script> tag and everything that was inside it. After re-opening the template I can see that the <script> tag  is gone and everything in it was deleted.

 

Does someone have any suggestions to make this work?

 

Thanks!

Hugo