output is not displaying on Background script

neelamallik
Tera Contributor
var gr = new GlideRecord('kb_knowledge');
gr.addQuery('workflow_state', 'draft');
gr.query();
while (gr.next()) {
    gr.deleteRecord();
}
 
neelamallik_0-1768728477277.png

 

1 REPLY 1

miftikhar20
Kilo Patron

Hi @neelamallik,
You can add gs.info(gr.getRowCount()); after the query() to check whether any records match your criteria. If the count is 0, there are no draft records to delete, which is why you’re not seeing any output.
If my response helped, please mark it as the accepted solution so others can benefit as well.   

Thanks & Regards,
Muhammad Iftikhar

If my response helped, please mark it as the accepted solution so others can benefit as well.