Expand my Community achievements bar.

Adobe Campaign User Groups are live now. Join our Adobe Campaign User Groups and connect with your local leaders!
SOLVED

how to call instance.vars.xxxx in node expr querydef

Avatar

Level 5

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

 

rvnth_2-1718980167613.png

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

rvnth_3-1718980412902.png

 

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

Topics

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

1 Accepted Solution

Avatar

Correct answer by
Employee

@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)

vraghav_0-1719192263216.png

vraghav_1-1719192285809.png

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

vraghav_2-1719192331147.png

 

View solution in original post

2 Replies

Avatar

Correct answer by
Employee

@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)

vraghav_0-1719192263216.png

vraghav_1-1719192285809.png

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

vraghav_2-1719192331147.png

 

Avatar

Level 3

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.