- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-16-2024 10:15 AM
This is something I'm just curious about as I'm creating a scheduled script that updates records. I'm trying to make sure I'm not touching records if it's unncessary, but what does actually happen if you do a query with an updateMultiple and one of the records either partially or fully has the updated values?
What happens with my script if it runs and is updating 4 fields, but 2 of the 4 fields already match what I have set? Is there a performance impact, or is the Glide Update smart enough to tell that those updates aren't needed and ignores them?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-16-2024 10:35 AM - edited ‎07-16-2024 10:36 AM
When using ServiceNow's updateMultiple() method to update records, the system does not automatically verify that the current values in the fields match the new values being set. It just updates the fields with the provided values, whether or not they have changed. This means that if you use updateMultiple() in a query and some of the fields already have the appropriate values, those fields will be written to the database.
There could definitely be a performance issue; even if you don't have anything to update, it will still update the record.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-16-2024 10:35 AM - edited ‎07-16-2024 10:36 AM
When using ServiceNow's updateMultiple() method to update records, the system does not automatically verify that the current values in the fields match the new values being set. It just updates the fields with the provided values, whether or not they have changed. This means that if you use updateMultiple() in a query and some of the fields already have the appropriate values, those fields will be written to the database.
There could definitely be a performance issue; even if you don't have anything to update, it will still update the record.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-16-2024 11:08 AM
Thanks for the input! I couldn't find any concrete answer on this so thank you for confirming that. I'll make sure that my query limits the number of records as much as possible so it's only looking at the records I want to update.