コミュニティアチーブメントバーを展開する。

Join us on September 25th for a must-attend webinar featuring Adobe Experience Maker winner Anish Raul. Discover how leading enterprises are adopting AI into their workflows securely, responsibly, and at scale.
解決済み

Dynamic Personalization of content in AJO Email Template Designer

Avatar

Level 2

HI All,

Recently there was a use case in which we need to update a Number based on a contextual attribute in email designer of AJO.

Let say there are 4 attributes in my schema each has a boolean value in it.
ATTR1, ATTR2, ATTR3, ATTR4                                     True/ False

A journey - Unitary Event Based trigger using the above schema -> email ( 2 nodes )

Basically in my email, based on the values of the contextual attributes I need to output 4 statements each related to a attribute.

Sample Example- 1
ATTR1 - True , ATTR2 - True , ATTR3 - True ,ATTR4 - True 

Since all are true I need to output the below texts in the editor along with numbers at front
1. Statement 1
2. Statement 2
3. Statement 3
4. Statement 4

Sample Example- 2
ATTR1 - True , ATTR2 - False , ATTR3 - False ,ATTR4 - True 

Since 1 and 4 are true I need to output the below texts in the editor ( As we see the numbers are constant but the statements changes)
1. Statement 1
2. Statement 4

------------------------------------------------------------------------------------------------------------------------------
So the catch here is to dynamically adjust numbers as we print the statements.
----------------------------------------------------------------------------------------------------------------------------

I have tried to use the Dynamic 'If' conditions but this doesn't solve the numbers issue. So I need to maintain a counter or something that could increase only when something is printing. But did not find any useful functions here.

Thanks in advance

トピック

トピックはコミュニティのコンテンツの分類に役立ち、関連コンテンツを発見する可能性を広げます。

1 受け入れられたソリューション

Avatar

正解者
Level 5

Hi @TheFinder1 

The previous was the sudo code, let allows you to define expression variable.

 

{%let counter= 0%}

{%#if true%}
{%let counter=counter+1%}
{{counter}} Statement 1<br>
{%/if%}
{%#if true %}
{%let counter=counter+1%}
{{counter}} Statement 2<br>
{%/if%}
{%#if true%}
{%let counter=counter+1%}
{{counter}} Statement 3<br>
{%/if%}
{%#if true%}
{%let counter=counter+1%}
{{counter}} Statement 4<br>
{%/if%}

 

I'm wondering why not define a number list in HTML instead of handling it it via logic.

 

cc: @Sukrity_Wadhwa 

元の投稿で解決策を見る

4 返信

Avatar

Level 5

@TheFinder1 you can use the counter in the if else condisiotn 

 

{{#set "counter" 0}}
{{#if ATTR1}}
  {{increment "counter"}}
  {{counter}}. Statement 1<br>
{{/if}}
{{#if ATTR2}}
  {{increment "counter"}}
  {{counter}}. Statement 2<br>
{{/if}}
{{#if ATTR3}}
  {{increment "counter"}}
  {{counter}}. Statement 3<br>
{{/if}}
{{#if ATTR4}}
  {{increment "counter"}}
  {{counter}}. Statement 4<br>
{{/if}}

 

or if these flags are in an Array loop through them using each to iterate, and for the counter, use the index to display the sequence numbers.

Avatar

Level 2

Can we use this kind of javascript in AJO email Personalization Editor?. As I did not find any set or increment helper functions to use.

Actually I was testing with this approach, 

A Journey : event -> email
Email content - need to test this personalization code

ATTR1,2,3,4 are some event attributes.

Code-

{{#if ATTR1}}
1. Statement 1<br>
{{/if}}
{{#if ATTR2}}
{{#if ATTR1}}2{{else}}1{{/if}}. Statement 2<br>
{{/if}}
{{#if ATTR3}}
{{#if ATTR1}}{{#if ATTR2}}3{{else}}2{{/if}}{{else}}{{#if ATTR2}}2{{else}}1{{/if}}{{/if}}. Statement 3<br>
{{/if}}
{{#if ATTR4}}
{{#if ATTR1}}{{#if ATTR2}}{{#if ATTR3}}4{{else}}3{{/if}}{{else}}2{{/if}}{{else}}{{#if ATTR2}}{{#if ATTR3}}3{{else}}2{{/if}}{{else}}{{#if ATTR3}}2{{else}}1{{/if}}{{/if}}{{/if}}. Statement 4<br>
{{/if}}

Avatar

Administrator

Hi @KotiSyamala,

Can you please help @TheFinder1 further with the query?

Thanks!



Sukrity Wadhwa

Avatar

正解者
Level 5

Hi @TheFinder1 

The previous was the sudo code, let allows you to define expression variable.

 

{%let counter= 0%}

{%#if true%}
{%let counter=counter+1%}
{{counter}} Statement 1<br>
{%/if%}
{%#if true %}
{%let counter=counter+1%}
{{counter}} Statement 2<br>
{%/if%}
{%#if true%}
{%let counter=counter+1%}
{{counter}} Statement 3<br>
{%/if%}
{%#if true%}
{%let counter=counter+1%}
{{counter}} Statement 4<br>
{%/if%}

 

I'm wondering why not define a number list in HTML instead of handling it it via logic.

 

cc: @Sukrity_Wadhwa