Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

Collapsing content blocks?

curtisv6802366
Level 1
Level 1

Is it possible to have a dynamic content block collapse completely? 

An example of the goal we are trying to achieve.  Within a dynamic content block we have three variations: the default, block A and block B.  Block A will appear if the profile is 21-30 years old.  Block B will appear if the profile is 31-40 years old.  If the profile doesn't fit within either of those age ranges, we'd like for this block to collapse and disappear completely.  If we leave the default block empty it does collapse but not completely, it still leaves one line of code.  Outside of creating a two separate template, is it possible to have a block collapse completely?

3 Replies
AbdulZa
Level 4
Level 4

I have the same question. Our client has an email layout/template with 8 zones/dynamic blocks. Local dealer campaigns are simple and the they may use only 1-2 zones/blocks. We are researching the same capability.

davidl14970702
Level 5
Level 5

I do this regularly. See Screen Shot below. In that email there are several combinations (usually 20-30 ) of each block depending on what city there person is registered to attend. Here is my Litmus code if you want to see Builder , the images probably wont render but you can get a better idea.

Based on what you listed here is how I would approach your scenario.

<% if ( recipient.age >= 21 && recipient.age <= 30 ){ %><!--Block A HTML begins Here--><% }

else if ( recipient.age >= 31 && recipient.age <= 40 ) %><!-- Block B HTML begins Here--><% }

else { %><!--default Block HTML begins Here --><% } %>

When using the If statements I've found it important to nest comments with the statements. If they are right before the JS it will have errors.

Hope this helps.

Here is the email I did (well part of it, there are a lot of combinations).

blocks.png

Gaurang
Level 10
Level 10

Hi curtisv6802366,

Were you able to resolve your probleM?

Feel free to bump us if you still haven't.

Thanks,

Gaurang