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!

Unable to convert the ACC JS logic to AJO PQL Query logic

Avatar

Level 1

I'm Currently working on API Triggered campaign with in AJO and migrating Adobe V7 Realtime message center campaigns to AJO, when I'm trying to replicate the below JavaScript logic from ACC to AJO 

Help me with any references or code snippets to transfer below ACC logic to AJO PQL Query logic

Logic:
<% var sections = rtEvent.ctx.complexVariables.sections;
for each (var section in sections){
if(section.sectionName.toString().toLowerCase() == "dealer information" && section.bucketName.toString().indexOf("DLR_") != -1)
{
var dealerBucketName = section.bucketName.toString();
var dealerSectionName = section.sectionName.toString().toLowerCase();
}
else if(section.sectionName.toString().toLowerCase() == "dealer information" && section.bucketName.toString().indexOf("DLR_") == -1){
var dealerBucketName = '';
}
}%>

Expected API JSON Payload:

"context": {
"eventinfo": {
"sections": [
{
"sectionName": "Pressure",
"bucketName": "TPM_4",
"status": "GREEN"
},
{
"sectionName": "Maintenance",
"bucketName": "SM_6",
"status": "GREEN"
},
{
"sectionName": "Recall",
"bucketName": "RC_X",
"status": ""
},
{
"sectionName": "Information",
"bucketName": "DLR_3",
"status": ""
},
{
"sectionName": "Service Plan",
"bucketName": "DC",
"status": "GREEN"
},
{
"sectionName": "Connected Plan",
"bucketName": "C0",
"status": "GREEN"
},
{
"sectionName": "SiriusXM",
"bucketName": "0",
"status": ""
},
{
"sectionName": "Data Plan",
"bucketName": "WD_0",
"status": ""
}
],

Topics

Topics help categorize Community content and increase your ability to discover relevant content.

2 Replies

Avatar

Community Advisor

@Nutsa9858 Try along these lines,

{#each context.eventinfo.sections as |section|}}
{%#if section.display_name = "dealer information" AND contains(section.first_name, "DLR_") %}
<p>Dealer Bucket: {{section.display_name}}</p>
<p>Dealer Section: {{section.first_name}}</p>
{%/if%}
{{/each}}
Take a look at this documentation,
Use this personalization editor to tryout and see how it works, https://experienceleague.adobe.com/en/apps/journey-optimizer/ajo-personalization?lang=en
Thanks, Sathees

Avatar

Employee Advisor

@Nutsa9858 You can use the following snippet and use the respective variables for personalization.

{{#each context.eventinfo.sections as |s|}} 
  {%#if lowerCase(s.sectionName)= "dealer information" 
  and indexOf(s.bucketName, "DLR_") != -1 %}
     
      {%let dealerBucketName  = s.bucketName %}
      {%let dealerSectionName  = lowerCase(s.sectionName) %}
      
   {%else if lowerCase(s.sectionName)= "dealer information" 
  and indexOf(s.bucketName, "DLR_") = -1 %}
        {%let dealerBucketName  = "" %}
  {%/if%}
{{/each}}