How to use deleteMultiple

Supriya25
Tera Guru

Hi Team,

kindly help me on how to use deleteMultiple, which is best practice.

 

var gr = new GlideRecord('incident');

gr.addQuery('activ=false');

gr.query();

if(gr.next())

{

gr.deleteMultiple();

}

 

OR

 

var gr = new GlideRecord('incident');

gr.addQuery('activ=false');

gr.query();

gr.deleteMultiple();

 

6 REPLIES 6

Here’s an example script you can use for deleteMultiple. When doing a deleteMultiple, there is no need for the Query(). It’s also best to delete in chunks

 

var gr = new GlideRecord('table');

gr.addEncodedQuery(‘yourencodedqueryhere');

gr.setLimit(1000);

gr.deleteMultiple();

 

with that said, if your trying to do 100k records, use the table cleaner

 

Mark Correct if this solves your issue and also mark 👍Helpful if you find my response helped in any way 

Bert_c1
Kilo Patron

Hi ,

Daniel makes a good point, on deleting records in chunks. But you must use the proper field name 'active' not 'activ'. in your script.