Get a first look at what's coming. The Developer Passport Australia Release Preview kicks off March 12. Dive in! 

Removing Demo data from the VR Module V26.2.2

jatinvs
Tera Contributor

Hi,

I need help in removing demo data form the VR modules. I know the key tables and their related logic but there are 166 tables and its very tadious job.

 

 

Note : Servicenow platform should build an inteligence to prevent loading any demo data in the Production instance by mistake. Or atleast provide an option to remove it through the UI action or Script.

3 REPLIES 3

Tanushree Maiti
Tera Sage

 

 Hi @jatinvs 

 

You can log a case to Servicenow  for removing the demo data from instance.

 

How to remove demo data from a ServiceNow instance

 

Note: Incase of PDI instance- you can do it on your own.

 

 

Please mark this response as Helpful & Accept it as solution if it assisted you with your question.
Regards
Tanushree Maiti
ServiceNow Technical Architect
Linkedin:

Servicenow support says Demo data can be removed from the entire instance not at module level. This is not something I am looking for as demo data for other modules still required. Can't we remove module specific data? If there anyother way?

Hello

I Can Recommend you to Disable the Demo Records if they are not required,

If its still a Case to Delete it : First Make Sure to Transfer Demo Data from Each Table from PROD to Sub- PROD,

later you can use below Background Scripts OR Fix Scripts : On Single Table or All Tables Together as well: Make Sure Roll Back Check Box is Checked to recover them safely in case any issue happens. they can be recovered from Delete Record Module later by manual process

 

Note : Use Any 1 Script From the below Only. either First Glide Record on Single Table or All Table Together,

  var gr = new GlideRecord('Table Name');
    gr.addQuery('u_demo_data', true);
    gr.query();
    while (gr.next()) {
        gr.deleteRecord();
    }
//==========================================================================
    var myTables = [
        'sn_vul_vulnerability',
        'sn_vul_vulnerable_item',
        'sn_vul_solution',
        'sn_vdr_risk',
        'sn_vdr_assessment_instance'
    ];

    myTables.forEach(function(tbl) {
        var gr = new GlideRecord(tbl);
        gr.addQuery('source', 'demo');  // adjust condition
        gr.query();

        gs.print('Deleting from table: ' + tbl + ' Count: ' + gr.getRowCount());
        gr.deleteRecord();
    }
Thanks and Regards
Gaurav ShirsatBackground Script-1.png