Easiest way to update multiple records from a table

mitzaka
Mega Guru

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?

1 ACCEPTED SOLUTION

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();


}


View solution in original post

12 REPLIES 12

Harish Murikina
Tera Guru

Open the table suppose incident.LIST. Right click on the header and click "Update All".



Regards,


Harish.


Yep, I thought of that but it does not work for me for some reason. I have a table which holds User records, and one field in there is a checkbox of the User form, which is false, and I would like to make it true.


I selected Update All, mark that to True, but nothing happens....weird


That is the way we can update all records not sure whats the issue.


You can update by using glideecord try that way if update all not working.



Regards,


Harish.


Kalaiarasan Pus
Giga Sage

i trust scripts ... try a background script ..



Filter the records in list view and copy the query....



var gr = new GlideRecord(table);


gr.addEncodedQuery('paste the copied query');


gr.query();


while(gr.next())


{


gr.field = value;


gr.setForceUpdate(true);


gr.setWorkflow(false);


gr.update();


}