How to Update a field value in bulk of around 80 thousands records?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-20-2022 10:52 PM
I am looking for a solution where I want to update a field value for around 80 thousand records. How to update it?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-20-2022 11:10 PM
Write a fix script to update the record and set the limit of records that you are going to update.
refer this for understanding fix script https://docs.servicenow.com/en-US/bundle/tokyo-application-development/page/build/applications/conce...
Example script
var gr = new GlideRecord('Tablename');
gr.setLimit(100); //This will update 100 records at a time, you can increase the limit but dont go overboard with the limit
gr.addEncodedQuery(active=true^fieldname!=NULL); //You can add any query here which is specific to your scenario.
gr.query();
while(gr.next())
{
gr.fieldname= 'test';
gr.setWorkflow(false); //Will not fire BR/email notifications
gr.update();
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-23-2022 06:18 PM
You can speed things up by using 'updateMultiple' instead of looping.
Check out Tim Woodruff's article on SN Pro Tips below for more info.
https://snprotips.com/blog/2016/12/20/pro-tip-use-updatemultiple-for-maximum-efficiency