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

Purge a List using JavaScript

Avatar

Avatar
Validate 10
Level 3
holmes74338504
Level 3

Likes

17 likes

Total Posts

51 posts

Correct Reply

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

Avatar
Validate 10
Level 3
holmes74338504
Level 3

Likes

17 likes

Total Posts

51 posts

Correct Reply

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

29-04-2020

Hello,

 

I need to purge a list through JS code. I understand I can do this in the workflow, but I need this done in JS since the list I need to delete is part of a Journey. My client will be dropping a list (Follow-up list) to load later in the Journey - but really no set date on when they will load it. So I have the workflow set to check daily if the list is empty or has been loaded. If empty, workflow resets to check the next day. If populated - then workflow will run as normal. 

 

Unfortunately, I'm really new to JS coding and I haven't found how to do the purge of the list through any documentation. 

 

Does anyone has an idea about how to proceed, or documentation they can point me too? 

 

Thanks a lot.

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar
Springboard
MVP
MarcelSzimonisz
MVP

Likes

102 likes

Total Posts

225 posts

Correct Reply

56 solutions
Top badges earned
Springboard
Establish
Contributor
Give Back 25
Give Back 10
View profile

Avatar
Springboard
MVP
MarcelSzimonisz
MVP

Likes

102 likes

Total Posts

225 posts

Correct Reply

56 solutions
Top badges earned
Springboard
Establish
Contributor
Give Back 25
Give Back 10
View profile
MarcelSzimonisz
MVP

29-04-2020

Hello, 

you want to reset the list every time there are records and are used?

You can do it by SQL activity where you truncate the list. The table of the list you can find in the list itself

marcel_gent_86_0-1588190679333.png

 

In the SQL activity or sqlExec() JSAPI function  I would use SQL command 'TRUNCATE TABLE grp110315177' everytime you chose to purge it

 

If it is just one time before you want to use list in production I would just go to the list and removed the records directly from the list through the explorer.

 

 

 

Answers (2)

Answers (2)

Avatar

Avatar
Contributor
MVP
Milan_Vucetic
MVP

Likes

166 likes

Total Posts

383 posts

Correct Reply

135 solutions
Top badges earned
Contributor
Springboard
Shape 1
Validate 25
Validate 10
View profile

Avatar
Contributor
MVP
Milan_Vucetic
MVP

Likes

166 likes

Total Posts

383 posts

Correct Reply

135 solutions
Top badges earned
Contributor
Springboard
Shape 1
Validate 25
Validate 10
View profile
Milan_Vucetic
MVP

30-04-2020

Hi @holmes74338504,

 

I have not used it but you may test the following code:

 

group.Unregister (XML recipientList)

 

This should delete selected records from the list.

 

Regards,

Milan

Avatar

Avatar
Validate 1
MVP
Darren_Bowers
MVP

Likes

78 likes

Total Posts

263 posts

Correct Reply

84 solutions
Top badges earned
Validate 1
Affirm 50
Establish
Give Back 3
Applaud 25
View profile

Avatar
Validate 1
MVP
Darren_Bowers
MVP

Likes

78 likes

Total Posts

263 posts

Correct Reply

84 solutions
Top badges earned
Validate 1
Affirm 50
Establish
Give Back 3
Applaud 25
View profile
Darren_Bowers
MVP

29-04-2020

The easiest way I found to purge a list was to use built-in workflow activities. Once I am done with the List I run a query on the list that selects 0 records then run an update List directly after. This purges the List.