0

First, I'm using content Builder to build emails. I have a section in my email where I need to either have a two column Layout or a three column layout dependent on data from my data extension. I've verified the variables pull in correctly and my DE code works, so I'm not including that section unless requested. Here's the code I'm attempting to use:

%%[ /* NUMBER OF TIME SLOTS SELECTOR */
if not empty(@time3) then
  ContentArea("40062")
else
  ContentArea("40061")
endif

Content ID 40062 is a three column layout with three time choices that has been tested and works when not being called by the ContentArea() command. Likewise 40061 is a two column layout that has been tested when actually placed in the email and works as expected.

This means that the problem must be in how I'm using the ContentArea() command. I looked through all the variations of these (e.g. ContentAreaByName(), ContentBlockbyId(), etc) and it looks like the only ones that don't specify that the content to be retrieved be a "block" type are the ContentArea calls. However when I'm using these I'm receiving this error:

The subscriber preview failed to generate. Review the details, correct all issues, and try again. The main email parsing loop fell into an invalid state of none of the current content qualifying for the content collection. Dynamic Content: null Script Block: start index: 0 HTTPGET Content: null

My feeling is that the command can't parse a "Layout" type object, has anyone had any success in doing something similar? if so how?

2

The issue is that ContentArea() will not read content blocks from Content Builder, only from Classic. For Content Builder content, you will need to use:

ContentBlockbyId(1, 2, 3, 4, 5)

ContentBlockbyKey(1, 2, 3, 4, 5)

ContentBlockbyName(1, 2, 3, 4, 5)

See release notes here and here for ContentBlockbyName()

See also this answer: Calling content areas new content builder

Pulling from @KevinIllick 's comment, please see the below code that now functions appropriately for him:

%%[
   /* NUMBER OF TIME SLOTS SELECTOR */
   if not empty(@time3) then

      output(ContentBlockbyID("40062"))

   else

      output(ContentBlockbyID("40061"))

   endif
]%% 

You can also accomplish it like this:

%%[
   /* NUMBER OF TIME SLOTS SELECTOR */
   if not empty(@time3) then

      SET @Content = ContentBlockbyID("40062")

   else

      SET @Content = ContentBlockbyID("40061")

   endif
]%% 

 <table><tr><td>%%=TreatAsContent(@Content)=%%</td></tr></table>
  • Also to note for anyone attempting this, you'll need an output() command prior to the other command you choose. Final working code: %%[ /* NUMBER OF TIME SLOTS SELECTOR */ if not empty(@time3) then output(ContentBlockbyID("40062")) else output(ContentBlockbyID("40061")) endif ]%% – Kevin Illick Sep 15 '17 at 13:08

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.