How to use autoSysFields(false) and setWorkflow(false)

How to use these fields in ServiceNow Script. Very useful when bulk updating.

autoSysFields(false) – does not update system fields.
setWorkflow(false) – does not run business rules

var inc = new GlideRecord("incident");
inc.addActiveQuery();
inc.query();
while (inc.next()) {
    inc.short_description = "setting all short descriptions";

    inc.autoSysFields(false); //do not update system fields
    inc.setWorkflow(false); //do not run business rules

    inc.update(); // update records

}

Leave a comment

Latest Posts