What It Does
The canWrite() method performs a read-only evaluation of write permissions for the current GlideRecord. It checks table-level ACLs, field-level security rules, and any custom security constraints without modifying data or triggering update-related Business Rules.
Internally, ServiceNow evaluates the same ACL conditions that would be checked during an actual update() operation, including role-based permissions, conditional ACLs, and field-level restrictions. The evaluation happens in the context of the current user session, respecting role inheritance and elevated privileges.
The method returns true if the user can write to the record, false if write access is denied. Unlike canRead(), this method never returns null or undefined values.
The permission check evaluates against the specific record currently loaded in the GlideRecord, not just table-level permissions. This means conditional ACLs based on field values, assignment rules, or custom scripts are properly evaluated. If no record is loaded (before get() or next()), the method returns false.
Related methods in the GlideRecord class include canRead() for read permissions, canCreate() for insert permissions, and canDelete() for delete permissions. Each method evaluates different ACL operation types and should be used for their specific use cases.
When to Use This
Use canWrite() before any setValue() or update() operations in server-side scripts where the current user context matters. This is especially critical in Business Rules, Script Includes called from client-side, and Scheduled Jobs that impersonate users. Without this check, ACL violations fail silently, leaving you debugging why records aren't updating.
Don't use canWrite() for create operations—use canCreate() instead. Avoid this method in before Business Rules where you're the system making changes—the permission check reflects the triggering user, not the system context. Skip permission checks entirely when using setWorkflow(false) since you're explicitly bypassing security.
In after Business Rules, canWrite() evaluates permissions against the NEW field values, not the original values that triggered the rule.
Return Value
Returns a boolean value: true if the current user has write access to the loaded record, false if access is denied or no record is loaded. The method never throws exceptions or returns null, making it safe to use directly in conditional statements without additional null checks.
When no record is currently loaded in the GlideRecord (before calling get() or next()), the method returns false since there's no specific record context to evaluate permissions against. Always ensure a record is loaded before relying on this method for permission decisions.
Enjoying this? Get one deep-dive per week.
Join 1,000+ ServiceNow pros — scripts, GlideRecord patterns, Flow Designer techniques, and career moves. Free.
Platform Behavior & Side Effects
- Triggers ACL evaluation scripts but does not fire Business Rules, Workflows, or send notifications
- Does not write anything to the database or create audit entries
- Performance is moderate—ACL script evaluation can be expensive with complex conditional logic
- ACL results may be cached within the same session, but permission changes during script execution are reflected immediately
- Evaluates permissions in the context of the current user session, including impersonation and elevated privileges
- In Business Rules, evaluates against the user who triggered the rule, not the system context
- Script Include functions called via AJAX inherit the client user's permissions, making this check essential