Delete Alerts from em_alert table in Bulk

Sam Johnson1
ServiceNow Employee
ServiceNow Employee

I have a use case where I need to delete a large number of records from the em_alert table. 

Does anyone have script or safe way to do this? 

1 ACCEPTED SOLUTION

Astik Thombare
Tera Sage

Hi @Sam Johnson1 ,

 

Navigate: Automated Test Framework > Administration > Table Cleanup

 

  • Click New
  • Tablename: <table to delete records>
  • Age in seconds: 1 day's worth of seconds (60x60x24 = 86400) or a week or whatever you want to keep
  • Cascade delete: true (that way it will clean up other data)
  • Then there are more conditions you can add.
  • Click Submit

 

Let the scheduled job Table Cleaner run it's schedule.   To check and verify there is a scheduled job.



Navigate: System Scheduler > Scheduled Jobs

 

  • Search Name: Table Cleaner

                  *Note the Next Action Date/Time



If the scheduled job does not exist - create a new job to repeat every hour, but this is an OOB job and should exist.



Once the scheduled job has run and completed - DELETE THE TABLE CLEANUP you created.   If not, you will continually delete the records from the table.

 

 

Reference- https://www.youtube.com/watch?v=7hCx--uDgws

 

Servicenow KB article - https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB0694151

 

  If my reply helped with your issue please mark helpful 👍 and correct ✔️ if your issue is resolved.

 

                         By doing so you help other community members find resolved questions which may relate to an issue they're having

 

 

Thanks,

 

Astik

View solution in original post

Table Cleaner ServiceNow | Delete Records Without Script in ServiceNow Enjoy the exclusive content - ServiceNow Basics Tutorials: https://www.youtube.com/playlist?list=PLrmQ9R9YkZmvGlU6zRVvtwQVndoXkvP0O ServiceNow Tips & tricks: ...
2 REPLIES 2

Astik Thombare
Tera Sage

Hi @Sam Johnson1 ,

 

Navigate: Automated Test Framework > Administration > Table Cleanup

 

  • Click New
  • Tablename: <table to delete records>
  • Age in seconds: 1 day's worth of seconds (60x60x24 = 86400) or a week or whatever you want to keep
  • Cascade delete: true (that way it will clean up other data)
  • Then there are more conditions you can add.
  • Click Submit

 

Let the scheduled job Table Cleaner run it's schedule.   To check and verify there is a scheduled job.



Navigate: System Scheduler > Scheduled Jobs

 

  • Search Name: Table Cleaner

                  *Note the Next Action Date/Time



If the scheduled job does not exist - create a new job to repeat every hour, but this is an OOB job and should exist.



Once the scheduled job has run and completed - DELETE THE TABLE CLEANUP you created.   If not, you will continually delete the records from the table.

 

 

Reference- https://www.youtube.com/watch?v=7hCx--uDgws

 

Servicenow KB article - https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB0694151

 

  If my reply helped with your issue please mark helpful 👍 and correct ✔️ if your issue is resolved.

 

                         By doing so you help other community members find resolved questions which may relate to an issue they're having

 

 

Thanks,

 

Astik

Table Cleaner ServiceNow | Delete Records Without Script in ServiceNow Enjoy the exclusive content - ServiceNow Basics Tutorials: https://www.youtube.com/playlist?list=PLrmQ9R9YkZmvGlU6zRVvtwQVndoXkvP0O ServiceNow Tips & tricks: ...