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

SOLVED

How to create an adobe campaign List using a json array of objects in a workflow

JamesAlio
Level 2
Level 2

Hello,

i have a workflow where i create a json array using javascript activity and i want to  create a new adobe campaign list (using js code) and add to it all the data in my json array  using "javascipt acitivity" or "update list" activity.

can you please show me how i can achieve this operation in my workflow. 

 

this is the code of my Js activity :

 

var arrayOfObjects = [{
  "id": 28,
  "Title": "Sweden"
}, {
  "id": 56,
  "Title": "USA"
}, {
  "id": 89,
  "Title": "England"
}];


vars.arrayOfObjects = JSON.stringify(arrayOfObjects); 

 Regards !

1 Accepted Solution
Manoj_Kumar_
Correct answer by
Community Advisor
Community Advisor

Hello @JamesAlio 

 

All adobe lists create a table in the DB. You can directly update that table with a SQl statement and execute that SQL statement with sqlExec.

 

You can get the list table name from the schema table as shown in this screenshot

_Manoj_Kumar_0-1610640971639.png

 

 

Now all you have to do iterate your object and do a sqlExec for each item.

 

Thanks,

Manoj

 

View solution in original post

5 Replies
Manoj_Kumar_
Correct answer by
Community Advisor
Community Advisor

Hello @JamesAlio 

 

All adobe lists create a table in the DB. You can directly update that table with a SQl statement and execute that SQL statement with sqlExec.

 

You can get the list table name from the schema table as shown in this screenshot

_Manoj_Kumar_0-1610640971639.png

 

 

Now all you have to do iterate your object and do a sqlExec for each item.

 

Thanks,

Manoj

 

View solution in original post

JamesAlio
Level 2
Level 2

Hello @Manoj_Kumar_ ,

Thank you so much for your response it's very clear.

i still have one more question because in your response you assume that the list is already created ? there is any why to create the list (table) during the workflow execution i mean using my js code before start persisting the data?

 

Thanks in advance.

Manoj_Kumar_
Community Advisor
Community Advisor
Yes, you can create a table directly but adobe won't treat this as a list.
JamesAlio
Level 2
Level 2
okay , can you please show me how i can create the table or just give me a documentation link that shows how to. im beginner in ACC i start working on it since 1 month but i m a web developper already. Thanks
Manoj_Kumar_
Community Advisor
Community Advisor
Go to Profiles & targets > Lists and create a list. This will automatically create a list and the table in database.