. How we can update record without updating system generated fieldsupdate sets

Narayana RC
Tera Contributor

. How we can update record without updating system generated fields

10 REPLIES 10

var gr = new GlideRecord('incident');

// Change all Open(1) incidents to Active(2)

gr.addQuery('state', 1);
gr.query();

while (inc.next()) {
  gr.autoSysFields(false);   // Do not update sys_updated_by, sys_updated_on, sys_mod_count, sys_created_by, and sys_created_on
  gr.setWorkflow(false);     // Do not run any other business rules
  gr.setValue('state', 2);
  gr.update();


as you told that am using this method ....I need to know is there any other   methods to update....for coming to   client scripts...is it possible


Nothing from client side. You can trigger this from Server and update all records per your req.


I appreciate   your reply....Thank you


Vivek Verma
Mega Sage
Mega Sage

‘autoSysFields’ is used to disable the update of ‘sys’ fields (Updated, Created, etc.) for a particular update. This really is only used in special situations. The primary example is when you need to perform a mass update of records to true up some of the data but want to retain the original update timestamps, etc.

 

//Change the category of all 'software' incidents to 'hardware' without updating sys fields
var gr = new GlideRecord('incident');
gr.addQuery('category', 'software');
gr.query();
while(gr.next()){
   gr.category = 'hardware';
   gr.autoSysFields(false);
   gr.update();
}
 
 
 
Thank You!
Please do mark as helpful Or correct answer.