Delete All Records Does Not Delete All Records

johndurden
Kilo Contributor

I've done some searching on the community and elsewhere hoping to find someone else talking about this issue we're having, but I'm not finding anything. Fairly often we need to delete all the records from some tables. In the current situation, there are 115,000 records we need to delete. When go to Tables & Columns > choose the table > click "delete all records", it works for about 5 minutes, then stops. I receive no errors or feedback. It just stops deleting records and it has to be restarted.

 

The fact that it's taking right around 5 minutes every time makes me think it's a 5 minute timeout. But I don't see a system property for that. Maybe I just need some educating on this. What's going on here? Is there a quicker or better way to delete all the records from tables?

1 ACCEPTED SOLUTION

Michael Ritchie
ServiceNow Employee
ServiceNow Employee

Its likely Transaction Quotas that are "killing" the transaction.   You can verify by searching the logs for message contains "maximum execution time exceeded" as mentioned in the Docs article.


View solution in original post

10 REPLIES 10

antin_s
ServiceNow Employee
ServiceNow Employee

Hi John,



Yes, thats the case with OOB UI Action and regular UI Actions. There is no difference. Look at the code of OOB Delete UI Action, you won't find anything special there.



Hope this helps. Mark the answer as correct/helpful based.



Thanks


Antin


andrew_venables
ServiceNow Employee
ServiceNow Employee

I believe there is a 5 minute timeout on the load balancers, so even if you do adjust the transaction quota rules the UI may timeout after 5


minutes.



Good practice when deleting lots of records is to either do them in small manageable chunks or use a scheduled job which will run as a non-interactive transaction and therefore not be subject to the usual timeouts.



always excercise caution when deleting large amounts of records!


bernyalvarado
Mega Sage

Using a scheduled job is always the best way to go about deleting a large amount of records.



I'll recommend you first use a .setLimit and perhaps a .log just to validate at first that your script is correctly looking at the right list of items that needs to be deleted.



Thanks,


Berny


antin_s
ServiceNow Employee
ServiceNow Employee

Hi John,



Any UI action (Delete button,..etc) will timeout after 5 mins (or the threshold set at the instance). I would suggest to write a Fix script and 'Run it in Background'. I have done it multiple times. It works.



Hope this helps. Mark the answer as correct/helpful based on impact.



Thanks


Antin


vinothkumar
Tera Guru

Hi John,



As Antin suggested, create a on demand scheduled job, and click on execute now button, so that it will run in the background.



I suggest you to do in non business hours.