What It Does

The autoSysFields() method controls whether ServiceNow's database layer automatically updates system audit fields during insert() and update() operations. When enabled (the default behavior), ServiceNow automatically sets sys_updated_on to the current timestamp, sys_updated_by to the current user's sys_id, and increments sys_mod_count.

Internally, ServiceNow's database abstraction layer checks a flag on the GlideRecord instance before executing the SQL statement. When autoSysFields(false) is called, this flag is disabled, and the platform skips the automatic field updates entirely. The database operation proceeds with whatever values are explicitly set in the GlideRecord, or leaves existing values unchanged if no explicit values were provided.

The method returns void and affects only the current GlideRecord instance. Each GlideRecord maintains its own auto-system-fields flag, so disabling it on one record doesn't affect other GlideRecord instances, even those querying the same table. The setting persists for the lifetime of the GlideRecord object, applying to all subsequent insert() or update() calls.

An important edge case occurs with bulk operations: if you're iterating through multiple records with a single GlideRecord instance, calling autoSysFields(false) once disables auto-updates for all records processed by that instance. The flag doesn't reset between next() iterations. Additionally, the method has no effect on client-side GlideRecord operations or on records modified through the UI—it only applies to server-side database operations.

The method is closely related to setWorkflow(false) and setAbortAction(true) in migration scenarios. While setWorkflow() controls business rules and workflow execution, autoSysFields() operates at a lower level, affecting the database operation itself rather than the business logic layer.

When to Use This

Use autoSysFields(false) primarily during data migrations when you need to preserve the original audit trail from a source system. This is essential when importing historical data where maintaining the original created/updated timestamps and user references is critical for compliance or audit purposes. The method is also valuable in bulk data operations where you're synchronizing records from external systems and need to maintain their original modification metadata.

Avoid using this method in normal business logic or interactive processes where users expect to see accurate "last modified" information. Instead, use setValue() or direct field assignment for regular record updates. Don't use autoSysFields(false) as a way to avoid triggering business rules—use setWorkflow(false) instead, which is the correct method for that purpose.

⚠️

Never disable auto-system-fields in production business processes unless you explicitly manage audit fields yourself. Missing or stale audit information breaks change tracking and can cause compliance issues.

Return Value

The method returns void and cannot fail in the traditional sense—it simply sets an internal flag on the GlideRecord instance. There's no success or failure condition to check, and no return value to validate. The method always completes successfully regardless of the current state of the GlideRecord or the validity of the boolean parameter.

Since there's no return value, you cannot chain this method or use it in conditional statements. The effect of the method is only visible in the behavior of subsequent insert() or update() operations—you must examine the resulting database records to verify that system fields were or were not automatically updated as expected.

Free Newsletter

Enjoying this? Get one deep-dive per week.

Join 1,000+ ServiceNow pros — scripts, GlideRecord patterns, Flow Designer techniques, and career moves. Free.

No spam · Unsubscribe anytime

Platform Behavior & Side Effects

  • Business rules, ACLs, and notifications still execute normally—this method only affects automatic system field updates, not the workflow engine
  • Audit records are still created for the database operation, but they may contain stale or explicitly set system field values rather than current timestamps
  • Performance impact is minimal—the method simply sets a boolean flag and doesn't involve database queries or complex processing
  • Works identically in before/after business rules, script includes, and scheduled jobs—the database layer handles the flag consistently across all server-side contexts
  • When disabled, explicitly setting sys_updated_on, sys_updated_by, or sys_mod_count in your code will write those exact values to the database without platform interference
  • Client-side GlideRecord operations ignore this method entirely—it only affects server-side database operations executed through the Java database layer
  • The flag persists across multiple operations on the same GlideRecord instance but resets when you create a new GlideRecord object