how to completely delete demo data on Self Hosted instance?

maronis
Mega Guru

Hi,

my client hosts Servicenow in its network - self hosted architecture - and configured the related architecture(server, nodes...).

Once the instance was ready for use by developers, we realized that the instance comes with demo data. There was no was to optionally add these.

Therefore ServiceNow communicated us the following steps to delete demo data ourselves :

Process to delete demo data:

High-Level Steps (test this in sub-prod first)

1. Log in to your instance as an Admin user with elevated security_admin role (once logged, click User Profile > Elevate Roles > select checkbox security_admin > OK)

2. Navigate to: System Definition > Scripts - Background

3. Copy and paste below script in the "Run script (JavaScript executed on server)"

gs.loadBatchScript(‘clean_demo_data.js’)

4. Ensure in scope "global" is selected, then click "Run script"

5. The script will run for approximately 20 to 50 mins as per the ServiceNow release, please wait for this to complete before any further activity on the instance

6. On completion of the script:

- Review script log for errors (note that you will likely see approx. 40 errors or more errors depends as per the release, for example: observed +1000 errors in Rome release with the message "not allowed because of a reference in record")

- Verify removal of demo data, and retention of data/records/configuration/users added by users

We did execute the script but as mentionned in the step 6. there are still demo data left (location, survey instances...).We can manually delete these demo data and all their dependencies by checking one table at a time but it is time consuming. Has anyone ever encountered this issue and found a good solution?

Best regards,

Maron

4 REPLIES 4

bammar
Kilo Sage
Kilo Sage

Not sure if you can try cloning the instance but setting it not to copy records.  then cloning back a true  full clone

BTW - since it is development - often times devs may not care if there are 2 incidents or 10000 - however I am aware sometimes records in certain tables are actually configurations- or used for reference and when referenced may contain data that is unwanted and result in unwanted behavior and it will be hard for the dev to know if it was demo data or not...

One other way maybe is to divide and conquer- have devs go to the different tables one and for all and removing the data. If the data is large on a certain table script for it...

I think the situation is complex because the seemingly big breadth of the amount of tables with demo data- 

maronis
Mega Guru

Hi Bammar,

thank you for your input. It is nice to brainstorm.

- cloning the instance does not allow the deletion of demo data.

- I am referring to the PROD instance, not DEV instance. Of course, we are trying to delete the demo data on DEV first but the target is the PROD instance. The current workaround is to manually delete demo records one at a time on SNOW tables but :

- there are a lot of tables among which "data table" like incidents, "configuration table" like scheduled jobs. Only data tables records should be deleted but there are so many different tables and I do not know the purpose.

- there are records that must not be deleted (system User records for examples)

It is difficult to make sure that all demo data are erased, ServiceNow is able to achieve (hopefully) but in a self hosted environment, I do not know how to do that.

It is ok if there are some remaining demo data but it is not clean. What I can do so far is to delete foundation records (location, cost center, department, company, building, user, groups), ITSM records (incidents, problems, change)

Best regards,

Maron

 

This article would help

https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB0693867

tidert_24
Kilo Sage

Hello @maronis 

I tried to run the script

gs.loadBatchScript(‘clean_demo_data.js’)

In Scripts - Background but it has an error saying: 

Script compilation error: Script Identifier: null.null.script, Error Description: illegal character (null.null.script; line 1), Script ES Level: 0, Interpreted Mode: true
Javascript compiler exception: illegal character (null.null.script; line 1) in: gs.loadBatchScript(‘clean_demo_data.js’) 

 I already elevated my role to security_admin for this. Is it also because I have executed this one in the PDI?

 

Thank you in advance for answering my question.