difference between deleteRecord() and deleteMultiple()
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-29-2020 01:55 PM
Could you please help to understand the difference/uses between "deleteRecord" and "deleteMultiple".
Thanks in advance!!!
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-29-2020 02:43 PM
Difference is mainly in performance. This has to do with the underlaying SQL action.
on SQL, if you want to do a modification to a record (this includes delete action) the database does some commit checks for EVERY record you do this. If you do the action for multiple record in 1 order, then the SQL does the same commit checks but only once saving time.
So basicly if you need to delete 5 records, it wont matter that much, if you want to delete 20.000 records then using deleteMultiple can save you a lot of time.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-30-2020 04:55 PM
I didn't even mention performance, whoops! Great post.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-29-2020 10:37 PM
Hi,
Please refer the below links
deleteRecord() & deleteMultiple()
deleteRecord() & DeleteMultiple()
Mark it Correct and Helpful, if my response helps you.
Thanks
Bhagyashri Sorte
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-29-2020 11:22 PM
Hello Skumar,
PFB,
deleteRecord() and deleteMultiple()
These two methods are for the deletion of one or more records from the database.
It should be made clear that deletion of records in ServiceNow is, and should be, generally a rare occurrence. Whenever possible, it is best to deactivate or otherwise mark a record as no longer in use, for historical and tracking purposes.
Neither deleteRecord() nor deleteMultiple() take any arguments, as both are called as methods of a specific GlideRecord object upon which they act. However, the similarities end there, as the behavior and usage of both of these methods are quite different.
deleteRecord() is used to delete a single record (in a GlideRecord) from the database. deleteMultiple() on the other hand, is used to delete all database records that match a given query. However, it is important to remember this: Do not usedeleteMultiple() on tables that contain currency fields. Instead, delete all such records one at a time, using deleteRecord().
If my answer is worth to you please mark correct and helpful.
regards,
Ganesh