Expand my Community achievements bar.

Never miss an update of the Adobe Journey Optimizer Community Lens! Subscribe now to get the latest updates, insights, and highlights delivered straight to your inbox every time a new edition drops.
SOLVED

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

Avatar

Level 2

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.

1 Accepted Solution

Avatar

Correct answer by
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}}

 

View solution in original post

4 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

Correct answer by
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}}

 

Avatar

Administrator

Hi @Nutsa9858,

Were you able to resolve this query with the help of the provided solutions, or do you still need further assistance? Please let us know. If any of the answers were helpful in moving you closer to a resolution, even partially, we encourage you to mark the one that helped the most as the 'Correct Reply.'

Thank you!



Sukrity Wadhwa

Avatar

Level 2

Hi @Sukrity_Wadhwa ,

Well Im able to resolve the logic thanks for the lookup!