unable to pass variable inside the function | Community
Skip to main content
Level 4
June 13, 2025
Solved

unable to pass variable inside the function

Hi Team,

I'm trying to dynamically set the locale in the formatCurrency() function in Adobe Journey Optimizer. Here's a simplified version of what I'm doing:

{%= formatCurrency(10000, "en_AU") %}

Instead of hardcoding "en_AU", I would like to pass a profile attribute (e.g., {{countryCode}} or profile.countryCode) that represents the locale dynamically.

However, when I try to pass an attribute like this:

{%= formatCurrency(10000, profile.countryCode) %}

I receive an error.

Could you please confirm if passing a dynamic attribute for the locale parameter is supported in AJO expressions? If so, what is the correct way to structure this?

 

@satheeskannak @mohan_dugganab @ajodev @davidkangni @anuhya-y 

AJODevAccepted solution
Level 4
June 13, 2025

Hello @ajo_wisdomchase , 

 

I think we cant give dynamic locales in AJO expressions instead you can code with if else condition with country codes.

I know it is not feasible way to do or add in personalization. if you know the data that how many country codes are included, if you want you can format into if else condition.

 

Thanks

AJODev

2 replies

Sukrity_Wadhwa
Employee
June 23, 2025

Hi @ajo_wisdomchase,

Was the given solution helpful to resolve your query or do you still need more help here? Do let us know. In case the given solution was helpful, then kindly choose it as the 'Correct Reply'.

Thanks!

Translate
Sukrity Wadhwa
AJODevAccepted solution
Level 4
June 13, 2025

Hello @ajo_wisdomchase , 

 

I think we cant give dynamic locales in AJO expressions instead you can code with if else condition with country codes.

I know it is not feasible way to do or add in personalization. if you know the data that how many country codes are included, if you want you can format into if else condition.

 

Thanks

AJODev

Translate