I can't delete record form location table

jaouad_essabir
Mega Contributor

Hello,

This is my first training on the ServiceNow, so i want to delete all the record from location table and import new record, but i can't delete all the record because of this message:

"Delete of 615 North Bush Street, Santa Ana,CA not allowed because of a reference in record Southern California Warehouse within the Stockroom file"

find_real_file.png

each record has a parent record on the same table, and this parent record has a parent record on the same table...etc

so it's impossible to delete 17 records.

Have u any help ? by using manuel delete, by script or other ?

Thanks for your help

Regards

1 ACCEPTED SOLUTION

Chuck Tomasi
Tera Patron

In a hierarchical configuration, you need to delete all the records the "end" records that have no children first. Once you have those, then you do it again and again until you reach the top of the tree structure. It's an iterative process in this case where you have parent records. Otherwise you could end up with a big mess with children referencing parents that aren't there.


View solution in original post

8 REPLIES 8

Hi Supriya,



Try going to System Definition> Tables. Locate the Location (cmn_location) table. Open that record, and click Delete All Records.



find_real_file.png


Yes I tried to delete the same but facing the error "


"Delete of 615 North Bush Street, Santa Ana,CA not allowed because of a reference in record Southern California Warehouse within the Stockroom file"


Sounds like another record is still referencing it somewhere. You need to find and resolve that.


Yes exactly. I found the solution that in StockRooms there is Reference of Location in this table.


Deleted the all records from stockRooms and I completely deleted the data from Location.