0

In Content Builder, I have personalization in a bullet list like this:

<ul style="color: rgb(128, 128, 128); font-family: arial, helvetica, sans-serif; background-color: rgb(255, 255, 255);">
 <li>
    <span style="font-size:14px;"><span style="font-family:trebuchet ms,helvetica,sans-serif;"><span style="color:#000000;">Uw Move On-<b>lidkaart(en)</b>.</span></span></span>
 </li> 

 %%[IF [ProductOption] == "Family" THEN]%%
 <li>
    <span style="font-size:14px;"><span style="font-family:trebuchet ms,helvetica,sans-serif;"><span style="color:#000000;">De lijst van de <b>begunstigeden </b> van uw contract.</span></span></span>
</li> 
 %%[ELSE]%%
 %%[ENDIF]%%
 <li>
    <span style="font-size:14px;"><span style="font-family:trebuchet ms,helvetica,sans-serif;"><span style="color: rgb(0, 0, 0);"><b>Exclusieve bonnen&nbsp;</b>die u kan inruilen wanneer u ze nodig heeft.</span></span></span>
</li>
 <li>
    <span style="font-size:14px;"><span style="font-family:trebuchet ms,helvetica,sans-serif;"><span style="color:#000000;">Een handige&nbsp;<b>gids </b>,waarin u alle Touring diensten&nbsp;kan raadplegen.</span></span></span>
    </li>
</ul>

I can save it and use it to send email but if I'm back in the HTML Editor, automatically bullets are added around the AMPScript as you can see below:

<ul style="color: rgb(128, 128, 128); font-family: arial, helvetica, sans-serif; background-color: rgb(255, 255, 255);">
 <li>
    <span style="font-size:14px;"><span style="font-family:trebuchet ms,helvetica,sans-serif;"><span style="color:#000000;">Uw Move On-<b>lidkaart(en)</b>.</span></span></span>
 </li>
 <li>%%[ IF [ProductOption] == "Family" THEN]%%</li>
 <li>
    <span style="font-size:14px;"><span style="font-family:trebuchet ms,helvetica,sans-serif;"><span style="color:#000000;">De lijst van de <b>begunstigeden </b> van uw contract.</span></span></span>
</li>
<li>%%[ELSE]%%%%[ENDIF]%%</li>
<li>
    <span style="font-size:14px;"><span style="font-family:trebuchet ms,helvetica,sans-serif;"><span style="color: rgb(0, 0, 0);"><b>Exclusieve bonnen&nbsp;</b>die u kan inruilen wanneer u ze nodig heeft.</span></span></span>
</li>
<li>
    <span style="font-size:14px;"><span style="font-family:trebuchet ms,helvetica,sans-serif;"><span style="color:#000000;">Een handige&nbsp;<b>gids </b>,waarin u alle Touring diensten&nbsp;kan raadplegen.</span></span></span>
</li>
</ul>

And so it does not work correctly anymore.

Does somebody have a solution?

2 Answers 2

1

If you don't want to enter this AMPScript inside an HTML only content area and want to continue using the capabilities of a Rich Text/Free Form content area then you can wrap your AMPScript between HTML Comments.

Most of the time AMPScript blocks do not contribute to the rendering of the block and wrapping them in HTML comments allows you to keep a clean look on your email.

To convert your existing content area just use the code below.

<ul style="color: rgb(128, 128, 128); font-family: arial, helvetica, sans-serif; background-color: rgb(255, 255, 255);">
 <li>
    <span style="font-size:14px;"><span style="font-family:trebuchet ms,helvetica,sans-serif;"><span style="color:#000000;">Uw Move On-<b>lidkaart(en)</b>.</span></span></span>
 </li> 

 <!--%%[IF [ProductOption] == "Family" THEN]%%-->
 <li>
    <span style="font-size:14px;"><span style="font-family:trebuchet ms,helvetica,sans-serif;"><span style="color:#000000;">De lijst van de <b>begunstigeden </b> van uw contract.</span></span></span>
</li> 
 <!--%%[ELSE]%%-->
 <!--%%[ENDIF]%%-->
 <li>
    <span style="font-size:14px;"><span style="font-family:trebuchet ms,helvetica,sans-serif;"><span style="color: rgb(0, 0, 0);"><b>Exclusieve bonnen&nbsp;</b>die u kan inruilen wanneer u ze nodig heeft.</span></span></span>
</li>
 <li>
    <span style="font-size:14px;"><span style="font-family:trebuchet ms,helvetica,sans-serif;"><span style="color:#000000;">Een handige&nbsp;<b>gids </b>,waarin u alle Touring diensten&nbsp;kan raadplegen.</span></span></span>
    </li>
</ul>

As you can see I've simply included HTML comments around each block, they will still be read by Marketing Cloud and processed the same way they did before.

2
  • Be sure and check the text-only version of you email if you use HTML comments to hide AMPScript. Jun 13, 2017 at 16:52
  • Thank you very much for the solution we'll apply in the future.
    – user45515
    Jun 14, 2017 at 6:53
0

The answer is to not use the WYSIWYG editor and just stick with straight HTML code. What you're giving up in convenience, you're gaining in consistency. WYSIWYG editors are never a good long-term solution, especially when you're mixing HTML and AMPScript/SSJS/GTL in SFMC.

If a simpler use-case like this survives the WYSIWYG editor then I'd recommend simplifying your HTML manually:

<ul>
    <li>One</li>

    %%[if [ProductOption] == "Family" then ]%%

    <li>Two</li>

    %%[ endif ]%%

    <li>Three</li>
    <li>Four</li>
</ul>

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .