- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-25-2024 07:27 AM
Hi all,
I have to clear a lot of records (30k and will increase) every night, only in two fields (email & sso). After that, I have to import this data again (so I have only the active ones).
Obviously I can go record by record with GlideRecord, but I was wandering if exists a better way (a sort of deleteMultiple but only on specific fields)
I cannot find anything, but maybe I am searching wrong because I think it's a basic need.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-25-2024 07:33 AM - edited 07-25-2024 07:36 AM
You could try using updateMultiple(). See:
The docs suggest it should be able to empty out fields by using setValue([field_name], null) unless I'm reading it wrong
https://snprotips.com/blog/2016/12/20/pro-tip-use-updatemultiple-for-maximum-efficiency suggests its more performant in comparison to cycling through the GlideRecords individually but I've never used it, which is probably a mistake on my part.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-25-2024 07:33 AM - edited 07-25-2024 07:36 AM
You could try using updateMultiple(). See:
The docs suggest it should be able to empty out fields by using setValue([field_name], null) unless I'm reading it wrong
https://snprotips.com/blog/2016/12/20/pro-tip-use-updatemultiple-for-maximum-efficiency suggests its more performant in comparison to cycling through the GlideRecords individually but I've never used it, which is probably a mistake on my part.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-25-2024 07:34 AM
Hi there,
Have you considered creating a Scheduled Flow? And reading your description, most likely zero code involved.
Kind regards,
Mark Roethof
Independent ServiceNow Consultant
10x ServiceNow MVP
---
~444 Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-25-2024 07:54 AM
as an "old" SN adopter we have A LOT of scheduled jobs going on everyday, so it's difficult for me change the approach only for the last of the queue.
But I will surely watch your suggestion, maybe move the existing to scheduled flow it's painless (or maybe only a little pain 😅)