0

I am hiding text in my marketing cloud email based on if the subscriber is in CO. Now the code below works and I can fire off a preview and test that it's working. The issue is when I save the block, update existing, or just save the email my closing [end if] jumps up to right after the opening if statement. So when I go back into test the script no longer hides anything because it's not wrapped around the content any longer.

%%[IF TRIM([state]) == 'CO' OR SUBSTRING(TRIM([postal_code]),1,2) == '80' OR SUBSTRING(TRIM([postal_code]),1,2) == '81' THEN]%%
    <tr>
    <td align="center" class="m-padding-leftright-20px" style="font-size:0px;padding:10px 40px;word-break:break-word;">
    <div style="font-family:semplicitapro, rial, sans-serif;font-size:14px;line-height:20px;text-align:center;color:#ffffff;">
    Text I am turning off based on location
    </div>
    </td>
    </tr>
    %%[ENDIF]%%

This is how it looks after it's saved and I leave to go into another email

%%[IF TRIM([state]) == 'CO' OR SUBSTRING(TRIM([postal_code]),1,2) == '80' OR SUBSTRING(TRIM([postal_code]),1,2) == '81' THEN]%% %%[ENDIF]%%
        <tr>
        <td align="center" class="m-padding-leftright-20px" style="font-size:0px;padding:10px 40px;word-break:break-word;">
        <div style="font-family:semplicitapro, rial, sans-serif;font-size:14px;line-height:20px;text-align:center;color:#ffffff;">
        Text I am turning off based on location
        </div>
        </td>
        </tr>
    
2
  • What kind of conent block do you store this in? Try using a Code Snippet
    – zuzannamj
    Commented Sep 24, 2020 at 15:16
  • Yea I was using a freeform block, I am now trying HTML block to see if that works. Don't know why they have anything in certain blocks that would reformat their own scripting language. Commented Sep 24, 2020 at 15:20

1 Answer 1

0

Looks like changing the block to an HTML block and not a freeform block maintained its formatting.

1
  • 1
    As a bit of a note, this answer ended up in one of the review queues. That gives us a choice of pre-defined ("canned") responses. High quality answers tend to go into more detail, so if you can find some documentation to support what you've found (or otherwise explain it), that'd make your answer better. For the record, I do think this is appropriate as an answer.
    – Derek F
    Commented Sep 24, 2020 at 16:34

You must log in to answer this question.

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