How to delete Huge amount of records using UI action

Mark Wood
Tera Contributor

Hello Experts,

I want to delete a large amount of data when a user clicks on a UI action button. In my script, I have used the deleteMultiple method, but it's only deleting a very small number of records, around 50, and my instance's performance is also degrading.

How can I efficiently delete these records without impacting instance performance?

1 ACCEPTED SOLUTION

Community Alums
Not applicable

Hi @Mark Wood ,

Please use below code as example for deleting all recods from table in UI action

 

Please modify table name as per your requirement.



  1. delContractRecords();    
  2. functiondelContractRecords()    
  3. {    
  4. var gr= newGlideRecord("ast_contract");    
  5. gr.query();
  6. gr.setWorkflow(false); //Don't fire Business rule,notifications  
  7. gr.deleteMultiple();    
  8. }  

View solution in original post

2 REPLIES 2

Community Alums
Not applicable

Hi @Mark Wood ,

Please use below code as example for deleting all recods from table in UI action

 

Please modify table name as per your requirement.



  1. delContractRecords();    
  2. functiondelContractRecords()    
  3. {    
  4. var gr= newGlideRecord("ast_contract");    
  5. gr.query();
  6. gr.setWorkflow(false); //Don't fire Business rule,notifications  
  7. gr.deleteMultiple();    
  8. }  

Hello @Community Alums 

the script you provided works well for deleting 20,000 records with a single click. However, when attempting to delete more than 20,000 records, it encounters issues.It deleted 9000 records I want to delete all records  Could you please provide guidance on how to delete all records successfully? Thank you for your assistance.