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
BedrockMission!

Learn More

View all

Sign in to view all badges

About get the result of Query Activity from JavaScript Activity in a workflow

Avatar

Avatar
Validate 10
Level 2
tumuzhuanjia
Level 2

Likes

6 likes

Total Posts

26 posts

Correct Reply

0 solutions
Top badges earned
Validate 10
Validate 1
Boost 5
Boost 3
Boost 1
View profile

Avatar
Validate 10
Level 2
tumuzhuanjia
Level 2

Likes

6 likes

Total Posts

26 posts

Correct Reply

0 solutions
Top badges earned
Validate 10
Validate 1
Boost 5
Boost 3
Boost 1
View profile
tumuzhuanjia
Level 2

07-06-2017

Hi

I created a workflow in Adobe Campaign as the follow

Start -> Query(query some recipients) -> JavaScript -> End

I query some recipients in the Query Activity, I can't find the way to get the result in the next JavaScript Activity.

Would you like to tell me how to do that.

Best regards

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar
Coach
MVP
david_garcia1
MVP

Likes

106 likes

Total Posts

183 posts

Correct Reply

41 solutions
Top badges earned
Coach
Contributor
Shape 1
Give Back 25
Give Back 10
View profile

Avatar
Coach
MVP
david_garcia1
MVP

Likes

106 likes

Total Posts

183 posts

Correct Reply

41 solutions
Top badges earned
Coach
Contributor
Shape 1
Give Back 25
Give Back 10
View profile
david_garcia1
MVP

09-06-2017

tumuzhuanjia

This is possible, by reading the temporary table created to hold the query data. (https://db.tt/aiCRLu3a66 )

  1. Add a Query and target recipient table
    •     Add complementary data (this is what you can use to query in the js activity and do stuff with it) https://db.tt/Ps2IRqkyil
  1. Add Js Activity with the following code and execute the workflow.

var schemaName = vars.targetSchema.substr(vars.targetSchema.indexOf(":") + 1);

var query = xtk.queryDef.create(

  <queryDef schema={vars.targetSchema} operation="select">

    <select>

      <node expr="@email"/>

    </select>

  </queryDef>

);

result = query.ExecuteQuery();

for each (var e in result) {

logInfo(e.@email);

}

Answers (3)

Answers (3)

Avatar

Avatar
Validate 1
Employee
Vapsy
Employee

Likes

369 likes

Total Posts

726 posts

Correct Reply

342 solutions
Top badges earned
Validate 1
Boost 50
Boost 5
Boost 3
Boost 250
View profile

Avatar
Validate 1
Employee
Vapsy
Employee

Likes

369 likes

Total Posts

726 posts

Correct Reply

342 solutions
Top badges earned
Validate 1
Boost 50
Boost 5
Boost 3
Boost 250
View profile
Vapsy
Employee

07-06-2017

Hi tumuzhuanjia ,

You can achieve this by using queryDef construct inside JavaScript activity. From the outgoing transition of query activity find out the schema name and then use in queryDef for reading your data.

An example of it can be found on the link Re: Update instance variable with target data field.

Hope it helps.

Regards,

Vipul

Avatar

Avatar
Validate 10
MVP
Amit_Kumar
MVP

Likes

329 likes

Total Posts

649 posts

Correct Reply

231 solutions
Top badges earned
Validate 10
Validate 1
Establish
Give Back 50
Give Back 5
View profile

Avatar
Validate 10
MVP
Amit_Kumar
MVP

Likes

329 likes

Total Posts

649 posts

Correct Reply

231 solutions
Top badges earned
Validate 10
Validate 1
Establish
Give Back 50
Give Back 5
View profile
Amit_Kumar
MVP

07-06-2017

Hi,

Accessing query data in JS activity is available for Reports and web applications so if you need that Read below:

This will be available in the CTX context and you can access it like ctx.query.recipient where query is the storage path of the query.

It's not available for campaign workflows because there you have some much flexibility to do everything without js so as a product feature in campaign workflow you don't have a storage path for queries.

refer to the attachment.

Capture.PNG

Regards,

Amit

Avatar

Avatar
Validate 25
Level 3
RaulOcana
Level 3

Likes

14 likes

Total Posts

58 posts

Correct Reply

4 solutions
Top badges earned
Validate 25
Validate 10
Validate 1
Boost 5
Boost 3
View profile

Avatar
Validate 25
Level 3
RaulOcana
Level 3

Likes

14 likes

Total Posts

58 posts

Correct Reply

4 solutions
Top badges earned
Validate 25
Validate 10
Validate 1
Boost 5
Boost 3
View profile
RaulOcana
Level 3

13-11-2019

Hi,

Can this be done with SQL-type-of query? I need to use Regular Expressions...

Thank you!