In the ServiceNow, setWorkflow() is generally used to prevent the running of business rules (or other scripts) that would be triggered by any server side updates you’re making.
setWorfklow can be used in any server-side script, including Business Rules, Script Includes, Scheduled Jobs, and (server-side) UI Actions.
The setWorkflow() method utilizes a single boolean argument of either true or false. The arguments are written as follows:
For example, Update the Urgency to High for all active Incidents where the Assignment Group is Network, without triggering any Business Rules that would normally execute during the update.
autoSysFields is used to to control whether the system automatically updates “system” fields when a record is inserted or updated.
By default, ServiceNow manages five specific fields for every record, Created by [sys_created_by],Created [sys_created_on], Updated [sys_updated_on], Updated by [sys_updated_by], Updates [sys_mod_count],
The autoSysFields () method utilizes a single boolean argument of either true or false. The arguments are written as follows:
For example, if we use the same script that includes the setWorkflow(false) method and additionally add autoSysFields(false), the urgency field will be updated to Medium. However, the system fields (such as Updated by, Updated on, etc.) will not be modified and will remain unchanged.
Here, we can observe that the system fields Updated and Updated by are not refreshed with the latest timestamp or user name.