Expand my Community achievements bar.

Enhance your AEM Assets & Boost Your Development: [AEM Gems | June 19, 2024] Improving the Developer Experience with New APIs and Events

Conditional blocks


Community Advisor

Hi all,


recently on Adobe Campaign we synchronized an AEM template which had around 100 conditional blocks (if statements) which caused Adobe Console to crash. Point was that template have different content per customer tariff plan (100 different tariff plans) and Adobe Campaign will send specific content according to tariff plan. 
As this template is really huge and from AC perspective "non-sense" I would like to hear is there a better way to solve this kind of issue on AEM? Can we avoid to many IF statements or pick some other approach which can handle this use case but from AEM side?




4 Replies



@BrianKasingli @Theo_Pendle  @arunpatidar  Please share your 2 cents here. 

Kautuk Sahni


Community Advisor


I am not sure how Adobe Campaign requests the content from AEM but based on my assumption -

I would suggest you can try using selectors(create a file, based on the selector and include in the main page) to filter/refine results further and call the AEM page based on the selector which can help reduce the conditions.

For example, If you can group the tariff further and create a selector file for each group and add conditions in the selector file for those tariffs only then you can easily reduce the execution time.

AEM will call group1.html if page /content/campaign/mypage.group1.html accessed.

Arun Patidar


Community Advisor

Hi @arunpatidar 

thank you for the answer.
An template from AEM is synchronized (downloaded) to Adobe Campaign as JSON content during sendout. Point is that this JSON is too huge as template have 100 "similar" blocks of the content (but with different picture or some price inside). Adobe Campaign then checking these if statements and when tariff plan of customers is matched that specific block is sent towards customers (so for one customer, AC is checking all 100 if blocks and pick only one where condition is met).  Of course, each customer has different tariff plan and specific content will be assigned and this is why AC is awesome as do message personalization on the fly. However, we have a lot different campaigns and different templates and usually have these if statements between 10-20 which is working fine. You will agree that around 100 blocks is really huge. This is why I am exploring workarounds on AEM to support these use case. Of course we can always create two templates with 50 blocks to have 100 at the end, but checking if there is a nicer way.


Community Advisor

Can't we have separate template for each usecase?

Or if we need to use one template only in if statements can't we reference content from separate pages?


These are two ways i can think of reducing content in one template