Expand my Community achievements bar.

SOLVED

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

Avatar

Level 3

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

Silvio6_0-1665589926231.png

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!

1 Accepted Solution

Avatar

Correct answer by
Employee Advisor

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

View solution in original post

5 Replies

Avatar

Employee Advisor

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

Denis_Bozonnet_1-1665591499960.png

 

Drag & Drop the default Content Fragment

Go back to the Edit Dynamic Content icon 

Denis_Bozonnet_2-1665591572701.png

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

Denis_Bozonnet_3-1665591666199.png

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

Denis_Bozonnet_4-1665591853604.png

 

Using the multi-lingual template might be beneficial.

Hope this helps,

Thanks

Denis

Avatar

Level 3

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

Silvio6_0-1665687863203.png

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

Silvio6_1-1665687913377.png

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

 

Thanks.

Avatar

Correct answer by
Employee Advisor

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

Avatar

Level 3

yep you're right, I was choosing an entry from the dropdown and it's not neccesary.

 

Thanks!

Avatar

Administrator

Hi @Denis_Bozonnet,

Could you please help @Silvio6 further with their query?

Thanks!



Sukrity Wadhwa