Url Personalization is not working with contextual attributes in AJO | Community
Skip to main content
AmarapuramMahesh
Level 2
March 17, 2026
Solved

Url Personalization is not working with contextual attributes in AJO

  • March 17, 2026
  • 2 replies
  • 72 views

Hi All,

We are trying to render a dynamic URL in an email button based on the contextual event attribute:
context.journey.events.`1116xyz`._tenant.applications.applicationType. The attribute applicationType is a string datatype and contains values such as:
"1"/"2"
Based on this value, we want to display different URLs in the email CTA button.

The logic implemented is( replaced with dummy values ):
{% let AppType = context.journey.events.`1116xyz`._tenant.applications.applicationType %}
{%#if AppType = "1"%}   
<a href="https://www.google.com/">Accept my Offer</a>
{%else if AppType = "2"%}  
  <a href="https://onboarding.xyz.com/">Accept my offer</a>
{%/if%}

If we click on validate. Validation successful.When we attempt to save the email content template in the journey, the validation fails with the PQL parsing error and the journey cannot be saved.

 Invalid syntax Invalid syntax Error in parsing PQL expression "context.journey.events.`1116xyz`._tenant.applications.applicationType="1&quot;": line 1:71 token recognition error at: '&'
Invalid syntax Invalid syntax Error in parsing PQL expression "context.journey.events.`1116xyz`._tenant.applications.applicationType=&quot;In 2&quot;": line 1:71 token recognition error at: '&'

Thanks 
Mahesh 

Best answer by IamCGK

Hey ​@AmarapuramMahesh 

 

The contextual attributes can’t be stored in the usual “let” variable fashion. Instead, with the help of “with” helper function one can define an alias for a contextual attribute.

 

See Example Code below

    {% let string = "" %}
{{#with context.journey.actions.xxxxx.path as |temp|}}
{% let string = temp %}
{{/with}}
{%#if string = "1" %}
<p>YOUR URL</p>
{%else%}
<p>YOUR URL</p>
{%/if%}

We encountered a similar issue where we couldn’t store variables but with the above logic it enabled us to use the output. Hope this helps!

Thanks,
Ganesh Kumar C

2 replies

Mohan_Dugganab
Adobe Employee
Adobe Employee
March 17, 2026

@AmarapuramMahesh kindly refer to this thread 

 

AmarapuramMahesh
Level 2
March 18, 2026

@Mohan_Dugganab ,The dynamic URL personalization isn’t working for the button.

Mohan_Dugganab
Adobe Employee
Adobe Employee
March 18, 2026

@AmarapuramMahesh 

Kindly use dynamic content as it should help achieve the same result.

 

Note from the referenced thread

 

IamCGKAccepted solution
Level 2
March 18, 2026

Hey ​@AmarapuramMahesh 

 

The contextual attributes can’t be stored in the usual “let” variable fashion. Instead, with the help of “with” helper function one can define an alias for a contextual attribute.

 

See Example Code below

    {% let string = "" %}
{{#with context.journey.actions.xxxxx.path as |temp|}}
{% let string = temp %}
{{/with}}
{%#if string = "1" %}
<p>YOUR URL</p>
{%else%}
<p>YOUR URL</p>
{%/if%}

We encountered a similar issue where we couldn’t store variables but with the above logic it enabled us to use the output. Hope this helps!

Thanks,
Ganesh Kumar C