Expand my Community achievements bar.

We are excited to introduce our latest innovation to enhance the Adobe Campaign user experience — the Adobe Campaign v8 Web User Interface!
SOLVED

Using fields related to the target as javascript variables

Avatar

Level 1

Hello !

I would like to create a workflow for reporting purposes, that would automatically use data relative to the last sent deliveries as an input to formulate queries and collect some data (tracking logs for example).

I'm able to generate the query to obtain those deliveries, and I added an enrichment with the delivery code. I would now like to create javascript variables using the values in the "Delivery code" column.

How could I proceed to create and use those variables ?

Regards,

Ombeline

1 Accepted Solution

Avatar

Correct answer by
Employee Advisor

Hi ombelinel78053619,

So I've used a simple query which I'm sure you can change as per your requirement1545627_pastedImage_2.png

Then I'm fetching the delivery code in Enrichment.

1545626_pastedImage_1.png

If you then see the schema of outbound transition it can be reached via schema temp:enrich. Please check in your case as well.

1545628_pastedImage_3.png

The add a JS code activity use the following code

1545775_pastedImage_4.png

var query = xtk.queryDef.create(

  <queryDef schema="temp:enrich" operation="select">

    <select>

      <node expr="@deliveryCode"/>  

    </select>

  </queryDef>);

var results = query.ExecuteQuery();

for each (var result in results) {

  logInfo(result.@deliveryCode);

}

I'm looping through the code to print them in the logs but you can modify the code to use in your setup.

Regards,
Vipul

View solution in original post

2 Replies

Avatar

Correct answer by
Employee Advisor

Hi ombelinel78053619,

So I've used a simple query which I'm sure you can change as per your requirement1545627_pastedImage_2.png

Then I'm fetching the delivery code in Enrichment.

1545626_pastedImage_1.png

If you then see the schema of outbound transition it can be reached via schema temp:enrich. Please check in your case as well.

1545628_pastedImage_3.png

The add a JS code activity use the following code

1545775_pastedImage_4.png

var query = xtk.queryDef.create(

  <queryDef schema="temp:enrich" operation="select">

    <select>

      <node expr="@deliveryCode"/>  

    </select>

  </queryDef>);

var results = query.ExecuteQuery();

for each (var result in results) {

  logInfo(result.@deliveryCode);

}

I'm looping through the code to print them in the logs but you can modify the code to use in your setup.

Regards,
Vipul

Avatar

Level 1

Thank you very much for your help Vipul !

I have used your code (just changing the variable name to resultsCrdrn). I just would like to know how to access the variable created in this query:

1545799_pastedImage_0.png

1545947_pastedImage_1.png

The idea would be to use Crdrn as a list, with the different delivery codes, so that I can select everyone who has been targeted with a delivery which is in the variable resultsCrdrn.

Could you please explain how to proceed ?

Thanks again,

Ombeline