Expand my Community achievements bar.

Dynamic Personalization of content in AJO Email Template Designer

Avatar

Level 1

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

Topics

Topics help categorize Community content and increase your ability to discover relevant content.

2 Replies

Avatar

Level 4

@JathiRatnalu 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 1

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}}