Dynamic Personalization of content in AJO Email Template Designer | Community
Skip to main content
New Participant
March 22, 2025
Solved

Dynamic Personalization of content in AJO Email Template Designer

  • March 22, 2025
  • 2 replies
  • 1081 views

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

Best answer by KotiSyamala

Hi @rakesh786 

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 

2 replies

KotiSyamala
KotiSyamalaAccepted solution
New Participant
April 2, 2025

Hi @rakesh786 

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 

KotiSyamala
New Participant
March 22, 2025

@rakesh786 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.

Rakesh786Author
New Participant
March 24, 2025

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

Sukrity_Wadhwa
Employee
April 2, 2025

Hi @kotisyamala,

Can you please help @rakesh786 further with the query?

Thanks!

Sukrity Wadhwa