2

We are attempting to migrate some content blocks from Classic Content to Content Builder in anticipation of Classic Content going away. This content is basically table rows that get dynamically pulled into an HTML Paste email. We have noticed two very problematic things happening. First, when we paste the rows into the editor, the editor alters the HTML. It completely removes entire sections - like a very bad magic trick. Second, even if we paste, save and immediately try to generate an email with that content block, it breaks the surrounding HTML. It seems that Content Building is embellishing our HTML and causing the table in our email to no longer work. Is there any way to pull in table rows HTML without getting any "extras"? Code Snippets won't work since these are dynamic emails and the content inserted varies by the week.

Before:

<!-- Spacer --> 
                <tr>
                   <td width="12" height="12" border="0" cellspacing="0" cellpadding="0" style="margin:0; width:12; height:12; background-color:#FFFFFF">
                   </td>
                </tr>
                <!-- /Spacer -->
   <tr>
  <td>
   <table align="center" width="600" cellpadding="0" cellspacing="0" border="0" style="margin:0;-webkit-text-size-adjust:100%; -ms-text-size-adjust:100%;background-color:#f0f0f0;">
    <tr>
     <td style="line-height:0px; mso-line-height-rule:exactly;"><a href="https://www.myecp.com/HtmlPages/CP_MilStartCard"><img src="http://image.email.shopmyexchange.com/lib/fe9612727265077874/m/11/d04308a1-4803-487d-8476-24f99e97ee07.jpg?b=1520520661000" width="600" height="64" alt="Earn Points with Military Star" style="display:block; margin:0; border:0;
      background-color:#f0f0f0; color:#C11A2C;
      font-size:11px; font-weight:bold;" /></a>
     </td>                                    
    </tr>
   </table>
  </td>
 </tr>

AFTER:

                <!-- /Spacer -->




 <table align="center" width="600" cellpadding="0" cellspacing="0" border="0" style="margin:0;-webkit-text-size-adjust:100%; -ms-text-size-adjust:100%;background-color:#f0f0f0;">
    <tr>
     <td style="line-height:0px; mso-line-height-rule:exactly;"><a href="https://www.myecp.com/HtmlPages/CP_MilStartCard"><img src="http://image.email.shopmyexchange.com/lib/fe9612727265077874/m/11/d04308a1-4803-487d-8476-24f99e97ee07.jpg?b=1520520661000" width="600" height="64" alt="Earn Points with Military Star" style="display:block; margin:0; border:0;
      background-color:#f0f0f0; color:#C11A2C;
      font-size:11px; font-weight:bold;"></a>
     </td>                                    
    </tr>
   </table>
  • what type of content block are you storing the HTML in? – Gortonington Mar 22 '18 at 17:12
  • I am using an HTML type block – V. Ryan Mar 22 '18 at 18:28
  • Entire rows of content are being removed. I tried to add screen shots of the before and after, but I don't appear to be able to. Basically, we have had spacer rows disappear and we have also had all tr tags completely stripped out of the block leaving nothing but stacked tables. I need a solution that will respect my HTML and not screw up my email. This is getting entirely frustrating. – V. Ryan Mar 22 '18 at 18:57
  • Before: <tr> <td width="12" height="12" border="0" cellspacing="0" cellpadding="0" style="margin:0; width:12; height:12; "> </td> </tr> <tr> <td> <table align="center" width="600" cellpadding="0" cellspacing="0" border="0" style="margin:0;"> <tr> <td ><a href="myecp.com/HtmlPages/CP_MilStartCard"><img src="image.email.shopmyexchange.com/lib/fe9612727265077874/m/11/…> </td> </tr> </table> </td> </tr> – V. Ryan Mar 22 '18 at 20:15
  • After: <!-- Spacer --> <!-- /Spacer --> <table align="center" width="600" cellpadding="0" cellspacing="0" border="0" style="margin:0;"> <tr> <td><a href="myecp.com/HtmlPages/CP_MilStartCard"><img src="image.email.shopmyexchange.com/lib/fe9612727265077874/m/11/…> </td> </tr> </table> – V. Ryan Mar 22 '18 at 20:16
2

The reason the spacer table is disappearing is because inside the eyes of SFMC editor (along with TinyMCE - which is used to handle the HTML processing from the WYSIWYG) it has no content, so it doesn't exist. Your spacer table needs some sort of entity in it. Usually what I do in these situations is as follows:

<table><tr><td><!--spacer-->&nbsp;<!--endspacer--></td></tr></table>

When set this way it retains the table as it has 'content' inside the table. If it thinks the table is empty, it will remove the 'excess' code when running its processor.

It does work when you use just the non-breaking space entity, but I find more success utilizing the comments around it too - sometimes just the nbsp will disappear as well.

As for the disappearing table row and table data tags, this can easily be solved via Code Snippet. I am not sure why in your use case you state it is not an option. You can utilize it inside an ampscript call utilizing the ID, same as a regular content block and it is selectable via Dynamic Content block.

Inside the HTML block, it is viewing the content as syntaxually incorrect as each block is viewed as a whole piece, not a snippet. In order to not break the block, it removes the invalid content. To get around this, you can add an if statement based on an impossibility that opens and closes a table tag at beginning/end to trick it into thinking it is valid.

I know this is not a long term solution, but for a quick fix this should do the trick if code snippets are not an option.

E.g. %%[ if 1 = 2 THEN]%% <table> %%[ENDIF]%%

%%[ if 1 = 2 THEN]%% </table> %%[ENDIF]%%

Full sample:

<!-- Spacer --> 
%%[ if 1 = 2 THEN]%% <table>  %%[ENDIF]%%
                <tr>
                   <td width="12" height="12" border="0" cellspacing="0" cellpadding="0" style="margin:0; width:12; height:12; background-color:#FFFFFF">
                   </td>
                </tr>
                <!-- /Spacer -->
   <tr>
  <td>
   <table align="center" width="600" cellpadding="0" cellspacing="0" border="0" style="margin:0;-webkit-text-size-adjust:100%; -ms-text-size-adjust:100%;background-color:#f0f0f0;">
    <tr>
     <td style="line-height:0px; mso-line-height-rule:exactly;"><a href="https://www.myecp.com/HtmlPages/CP_MilStartCard"><img src="http://image.email.shopmyexchange.com/lib/fe9612727265077874/m/11/d04308a1-4803-487d-8476-24f99e97ee07.jpg?b=1520520661000" width="600" height="64" alt="Earn Points with Military Star" style="display:block; margin:0; border:0;
      background-color:#f0f0f0; color:#C11A2C;
      font-size:11px; font-weight:bold;"></a>
     </td>                                    
    </tr>
   </table>
  </td>
 </tr>
%%[ if 1 = 2 THEN]%% </table>  %%[ENDIF]%%

Another solution is to store the snippets inside of a data extension, but then you can run into issues with format, etc. that can cause corruption of data and incorrect display.

  • We tried that - it still took it out. We also tried adding actual text and it still took it out. I have not tried adding comments. I really wish there was a way to turn off the HTML processing and make it respect the code I add. I don't need the system to think for me. Just do what I ask. – V. Ryan Mar 23 '18 at 13:42
  • The only way to do that would be to host the code in a DE or other database and inject it from there. This would then run into potential issues with formatting, etc. of data and file. E.g. UTF-8 vs ASCII translation. – Gortonington Mar 23 '18 at 15:12
  • 1
    I had stated that code snippets were not an option because I was not aware (nor had I seen it stated in the documentation anywhere) that code snippets could be pulled in with the ContentBlock functions. That will be our solution for this. It would be really helpful if the ability to call in Code Snippets could have been mentioned in the documentation. – V. Ryan Mar 26 '18 at 12:13
  • sfmc docs do tend to either be impossible to find, non-existent or sometimes just plain wrong. Glad we could help you find your solution! – Gortonington Mar 26 '18 at 12:36
  • FWIW, the AMPscript help for the contentblock functions makes it clear now that they pull in code snippets as well. developer.salesforce.com/docs/… – Don Owens Apr 12 '18 at 15:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.