What is the usage of the setForceUpdate() function? / Is it possible to update a record without updating its system fields such as sys_updated_by, sys_updated_on, etc.?

DWQA QuestionsCategory: QuestionsWhat is the usage of the setForceUpdate() function? / Is it possible to update a record without updating its system fields such as sys_updated_by, sys_updated_on, etc.?
Editor Staff asked 1 month ago

What is the usage of the setForceUpdate() function? / Is it possible to update a record without updating its system fields such as sys_updated_by, sys_updated_on, etc.?

1 Answers
Editor Staff answered 1 month ago

The setForceUpdate() function is used to update the record even if there are no changes on the record. Yes. It is possible to update a record without updating its system fields. For this, you have to use the function autoSysFields() in your server-side scripting. Whenever you are updating a record, set the autoSysFields() to false.
Example:
var gr = new GlideRecord(‘incident’);
gr.query();
if(gr.next()){
gr.autoSysFields(false);
short_description = “Test from Examsmyntra” ;
gr.update();
}