Insert content fragment as content block for dynamic content by preferred language | Community
Skip to main content
Silvio6
Level 5
October 12, 2022
Solved

Insert content fragment as content block for dynamic content by preferred language

  • October 12, 2022
  • 1 reply
  • 1538 views

Hi, I need to insert a content fragment but it should be dynamic per language. I read that it can be possible using a content block.

So I created this content block

 

 

<% if(context.profile.location.countryCode == 'GB') {%> <%@include contentModelFragment='CMDL44' %> <%} else if(context.profile.location.countryCode == 'CA') {%> <%@include contentModelFragment='CMDL27' %> <%} else if(context.profile.location.countryCode == 'US') {%> <%@include contentModelFragment='CMDL13' %> <%} %>

 

 

 

But I have the next error

I know it says it's some kind of typo, but I can't find the solution.

 

So, is it possible to create dynamic content fragments with content block? Is there an issue with the "@ include" statement?

 

Thanks!

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by bisswang

The dialog will always look the same no matter on the rule chosen.

Though you don't have to choose an entry from the dropdown.

You can just go ahead and e.g. enter US, GB and CA in the "variant name" field when creating the variants

1 reply

Adobe Employee
October 12, 2022

Hi @silvio6 

Why would you use Dynamic Content option in the Email Designer.

You add a structure let say 1:1 column) in which you enable Dynamic Content

 

Drag & Drop the default Content Fragment

Go back to the Edit Dynamic Content icon 

Select the 2nd label and you will see that there is no Content Fragment for your 2nd condition

Add a fragment and edit the Label to add a Condition on your case CountryCode

 

 

But in your case, why do you not use Multi-Lingual Delivery Template and you use the Country as your variance? The good thing about the Multi-lingual template is that you'll get the variant in the report

 

Using the multi-lingual template might be beneficial.

Hope this helps,

Thanks

Denis

Silvio6
Silvio6Author
Level 5
October 13, 2022

Thanks Denis. I choosed the Multilingual option.

 

But now I have another concern. The multilingual messages are created by default for "preferred language". I tried to create a new content block with the "Country Code" (as I have 3 different countries and each country should have a different template) 

I made this

But when I go to choose the variants it keeps the "Preferred language"

and when I send the email, it doesn´t respect the "Country code" rule.

 

Thanks.

bisswangAdobe EmployeeAccepted solution
Adobe Employee
November 8, 2022

The dialog will always look the same no matter on the rule chosen.

Though you don't have to choose an entry from the dropdown.

You can just go ahead and e.g. enter US, GB and CA in the "variant name" field when creating the variants