- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-16-2014 04:09 AM
Hi SNC,
What will be the quickest way to go through all the records in a table and update a certain field in all of those records?
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-16-2014 05:04 AM
script based on the info you have provided ...
var gr = new GlideRecord('u_org_admin');
gr.query();
while(gr.next())
{
var referenceRecord = gr.u_org_admin.getRefRecord();
referenceRecord.u_is_org_admin = true;
referenceRecord.setForceUpdate(true);
referenceRecord.setWorkflow(false);
referenceRecord.update();
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-16-2014 05:13 AM
Absolutely will take attention into it:)

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-16-2014 05:05 AM
script based on the info you have provided ...
var gr = new GlideRecord('u_org_admin');
gr.query();
while(gr.next())
{
var referenceRecord = gr.u_org_admin.getRefRecord();
referenceRecord.u_is_org_admin = true;
referenceRecord.setForceUpdate(true);
referenceRecord.setWorkflow(false);
referenceRecord.update();
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-18-2016 04:22 AM
Just wanted to add that you can use the updateMultiple as well. Here is an example from the wiki.
// update the state of all active incidents to 4 - "Awaiting User Info"
var gr = new GlideRecord('incident')
gr.addQuery('active', true);
gr.query();
gr.setValue('state', 4);
gr.updateMultiple();