how to call instance.vars. in node expr querydef | Community
Skip to main content
Level 5
June 21, 2024
Solved

how to call instance.vars. in node expr querydef

  • June 21, 2024
  • 2 replies
  • 1032153 views

Hi there, 

 

I have several JavaScript activities that retrieve the total record count based on split conditions. Now, I've added another JavaScript activity to extract the segment code from the split activity. Additionally, I'm attempting to access the instance.vars variable within this new JavaScript activity, which was previously defined in the split condition JavaScript activity. However, an error occurs stating that the "Unable to parse the expression"

1st Js Activity: instance.vars.countOfSegment_RecipientEmail =  vars.recCount

2nd JS Activity : <node expr={"+instance.vars.RecipientEmail+"}  alias="@Segment"/> -

The 2nd JS activity is throwing an error

 

I have implemented two split activities where I've defined instance.vars. in both. Now, I aim to retrieve and display these instances.vars declarations in a table format of an alert activity as shown below:

 

Please suggest if there's a more effective method to accomplish this task, or how I can reference instance.vars. in a node expression of query def

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 vraghav

@rvnth you can put an Enrichment activity between the two JS activities.

Inside the Enrichment, you can pull up the instance variable as a targetData element

$(instance/vars/@countOfSegment_RecipientEmail)

The instance variable will become part of the targetData which you can use in your second JS file to pull out as queryDef and show in Alert

 

2 replies

vraghav
Adobe Employee
vraghavAdobe EmployeeAccepted solution
Adobe Employee
June 24, 2024

@rvnth you can put an Enrichment activity between the two JS activities.

Inside the Enrichment, you can pull up the instance variable as a targetData element

$(instance/vars/@countOfSegment_RecipientEmail)

The instance variable will become part of the targetData which you can use in your second JS file to pull out as queryDef and show in Alert

 

ALangridge
Level 4
June 24, 2024

Hello! 

Just confirming that instance variables (instance.vars.myVar) are global, so it can only contain one value and will be overwritten if declared again.

It's a bit hard to figure this one out without the code from both activities, but I am pretty sure that you pass variables into XML just with {variable}, so 

<node expr={instance.vars.RecipientEmail}  alias="@Segment"/> 


If it isn't just a simple syntax error, I'd need to look at the code blocks to try and help more.