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

  • June 13, 2025
  • 2 replies
  • 412 views

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 

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by AJODev

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

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

Sukrity_Wadhwa
Community Manager
Community Manager
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!

Sukrity Wadhwa