Data cleanup - Background script

NishaB
Tera Expert

I want to delete demo data from my PDI by clicking on Remove Demo Data. I want the background script that shows all the objects that are deleted. In the script execution history, I got one code 

var sch = new ScheduleOnce();

sch.script = "gs.pause();gs.sleep(1000);gs.setCleaningDemoData(true);gs.loadBatchScript('clean_demo_data.js');gs.setCleaningDemoData(false);gs.resume();";

sch.setLabel("Remove demo data");

sch.schedule();

var SNJSON = JSON, writer;

 

writer = GlideTransaction.get().getResponse().getWriter();

 

if (typeof answer !== 'undefined') {

    writer.write(new SNJSON().encode(answer));

}

 

writer.flush();

writer.close();

 

I am not able to locate the clean_demo-data.js as it contains the logic of data clean up.  Is the script part of a standard ServiceNow feature (like demo data cleanup).

2 REPLIES 2

anubhavkapoor76
ServiceNow Employee
ServiceNow Employee

@NishaB -Its tricky to see what was deleted as a part of demo data cleanup

 

Yes - clean_demo-data.js is a script used for demo data cleanup.

 

You will not be able to access clean_demo-data.js as its ServiceNow internal.

 

Mark this post as helpful/correct if it works for you.

 

Sumanth16
Kilo Patron

Hi @NishaB ,

 

You can try the 'Deleted Records' module in the navigation menu.

 

If you find it helpful, please mark my answer as correct so that it can useful to others.

 

Thanks & Regards,

Sumanth meda