The CreatorCon Call for Content is officially open! Get started here.

Can you update a record without updating its system fields(like sys_updated_by, sys_updated_on)?

Vivek Verma
Giga Sage

Thank You !

4 REPLIES 4

Chandu Telu
Tera Guru

HI Soup

Please check the below link it may help you

https://community.servicenow.com/community?id=community_question&sys_id=fafac7addb5cdbc01dcaf3231f96195d

https://www.servicenowguru.com/scripting/gliderecord-query-cheat-sheet/

 

If so, please mark the response as correct so that others with the same question in the future can find it quickly and that it gets removed from the Unanswered list. Thank you

How To Mark Answers Correct From Community Inbox

dravvyramlochun
ServiceNow Employee
ServiceNow Employee

Hi 

 

Have a look at :

- https://community.servicenow.com/community?id=community_question&sys_id=fafac7addb5cdbc01dcaf3231f96195d

- https://www.servicenowguru.com/scripting/gliderecord-query-cheat-sheet/

 

Thanks,
Dravvy

Please Hit Helpful or Correct depending on the impact of the response

Vivek Verma
Giga Sage

autoSysFields


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

Ashutosh Munot1
Kilo Patron
Kilo Patron

HI,

 

You can use 

autoSysFields(false); and setWorkflow(false);

 

This will do your work.


Thanks,
Ashutosh Munot