Deleting Locations

serviceabraham
Kilo Explorer

Hello All

As a part of training I have this task:

The Customer Locations are all the ones that have XXX as City.

All the other location records need to be removed.

Note: To keep the Location hierarchy, do not remove the locations: AAA, BBB, CCC

I am looking here:

User Administration -> Locations

There are 421 records

When I run filter with City name there are 48 records

I am reading https://wiki.servicenow.com/index.php?title=Defining_Locations#gsc.tab=0

I am not sure how to delete other records any help is appreciated.

Thanks

Abe

6 REPLIES 6

Pradeep Sharma
ServiceNow Employee
ServiceNow Employee

Hi Service Abraham,



There are two ways. In the first approach you can filter the records and then select all and from the action drop down click on "Delete" button.


The other approach would be to construct the filter and then right click on the filter and copy the query. Once done you can GlideRecord the cmn_location table and delete the records from background script.



Please let me know if you have any questions.


Hello Pradeep



Thanks for the response.



I did not use the select all and delete because of the following:



When I search Locations


1. Without Filter   --> 421 records are found


2. With filter (City = San Diego)       --> 48


3. With Filter (City != San Diego) -->368



(City = San Diego) + (City != San Diego)   = 368+48 = 416     ( why is not equal to 421 ???)




And then I should not be deleting California, North America, Americas records, if I select all using (City != San Diego) and delete all records it will also delete California, North America, Americas records.



GlideRecord is something that may come in future of my training.




Please let me know, how I will be able to do this...




Thanks


Abe.




Hi,



Thanks for the update. Okay go to location table and then you can group by city.


Screen Shot 2015-09-19 at 10.53.51 PM.JPG


This will give you clear idea. I mean there might be city records which are empty.


Now you can delete from here. For example check the records you want delete. Please find the below screenshot for reference.


Screen Shot 2015-09-19 at 10.55.13 PM.JPG


Screen Shot 2015-09-19 at 10.55.52 PM.JPG



I hope this helps


Ok almost got it.. just one more question, before I hit delete button



When I search for City as San Diego I get 48 records and I can see 48 records ( paged by 20 records per page 20+20+8)



c48.PNG



When I group by City, it says 48 , but when I count records in that section it is only 20


c20.PNG



Are rest of records hidden, is it a feature of group by ...


There is nothing like bulk uncheck for city, so if I delete, 28 records of San Diego which I do not see may get deleted.



Please let me know how I can retain all 48 records of San Diego using group by City option.