Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

Adobe Campaign Classic - Java Script node LogInfo output to Query as a variable

MarioGlad
Level 3
Level 3

Hello,

Excuse such a trivial question, but I am new to Adobe Campaign, and I exhausted all possibilities within my reach to accomplish this.
I am trying to do the following: As you can see below, I have a Java Script node that reads the first, last, and email and then stores it in LogInfo. I would like to store the LogInfo data to a variable and parse it to a query node for further analysis/workflow purposes. Please, give me a few suggestions or corrections. Thank you,

 

Below is Java Script code:

MarioGlady_0-1628797416252.png

Sample workflow screenshot 

MarioGlady_1-1628797434103.png

 

 

4 Replies
Manoj_Kumar_
Community Advisor
Community Advisor

@MarioGlad  You can use this.
instance.vars.test=rcp.@firstName+" "+rcp.@lastName+" "+rcp.@test;

Jyoti_Yadav
Community Advisor
Community Advisor

Hi @MarioGlad 

 

Please follow below steps to achieve this:

1) In Javascript activity, save value as:

instance.vars.@fName = rcp.@firstName;

 

2) In query activity, define as:

First name = $(instance/vars/@fName)

Jyoti_Y_0-1629272829202.png

 

Thanks,

Jyoti

Sukrity_Wadhwa
Employee
Employee

Hi @MarioGlad,

 

Were you able to resolve this query with the help of the given solutions or do you still need more help here? Do let us know.

 

Thanks!

AnthonyGillEpsilon
Level 2
Level 2

You may want to consider using some JSON tricks for more complex patterns.  I've made an example with various tricks, below:

 

var obj = {}
logInfo("Converting " + rcp.toXMLString() + " to JSON")
obj.firstName = rcp.@firstName.toString(); // Make sure you use toString()
obj.lastName = rcp.@lastName.toString();

instance.vars.data = JSON.stringify(obj)
logInfo("JSON = " + instance.vars.data)

# .. Later on..

var data = JSON.parse(instance.vars.data)