Expand my Community achievements bar.

Join Adobe Journey Optimizer product experts for a live Ask Me Anything on October 15th at 8 AM PT about Expanding Your Mobile Reach with RCS & WhatsApp in AJO!

Contextual field with Helper function

Avatar

Level 1

I am facing some error when adding contextual field in function while trying to do some personalization in email with in a journey. 

Any idea on what could be the resolution for this ?

6 Replies

Avatar

Employee Advisor

Kindly use back ticks for the event Id 

Example -> context.journey.events.`1792665356`........

Avatar

Level 1

don't think that is correct syntax.

 

 

 

Avatar

Employee Advisor

It's a different error now and the function signature is not being matched. You are using an array object where as the function expects a string. You can validate it on the following lines

Example 
{{#each context.journey.events.`eventId`._tenant.npoEvent.traject as |s|}}
        {%= replaceAll(s.discountedPrice,"([0-9]+\\.[0-9]{2}).*","$1") %} 
{{/each}} 

 

Avatar

Level 1
Ok some confusion, will explain again. I need to use below syntax in email. i am not able to pass context field as replaceAll expecting string. So original question how do i pass context field here
 
{%= replaceAll(context.journey.events.923737463.Event.test.totalPrice, "([0-9]+\\.[0-9]{2}).*", "$1") %}

Avatar

Employee Advisor

Use it on the following lines as mentioned previously as traject is an array object and it needs to be iterated over. eventId needs to have backticks.

Example 
{{#each context.journey.events.`eventId`._tenant.npoEvent.traject as |s|}}
        {%= replaceAll(s.discountedPrice,"([0-9]+\\.[0-9]{2}).*","$1") %} 
{{/each}} 

 

Avatar

Employee Advisor

@riyaA 

Can you Reference contextual fields directly?

{{context.journey.events.923737463.LEAD_88_8_05.discountedPrice}}