Record deletion in ServiceNow is permanent and unforgiving. The deleteRecord() method doesn't ask for confirmation, doesn't move records to a trash folder, and executes immediately. Most tables don't maintain deletion history. The critical mistake developers make is assuming delete permissions — ACLs absolutely apply to delete operations, and canDelete() is your only reliable guard against silent failures where the method returns false with no error message.
When to use this
- When you need to programmatically remove specific records by
sys_idin server-side scripts - When cleanup or archival processes need to remove records based on business rules
- When you're certain the record should be permanently removed (not marked inactive)
- When working with staging tables or temporary data that has defined lifecycles
When NOT to use this
- Don't delete records when you should mark them inactive — use
setValue('active', false)instead - Don't use this for bulk deletions of hundreds of records — use
deleteMultiple()or batch processing instead - Don't delete records that have audit requirements — check table configuration first
- Don't use this in client scripts — it's server-side only and will throw errors
Key behaviors and gotchas
- You must call
get()first to load the record —deleteRecord()operates on the current record - ACL checks happen at delete time — even admin users can be blocked by table-level delete ACLs
- Business Rules and Script Engines fire on delete — before/after delete rules will execute
- Domain separation applies — you can only delete records in your accessible domains
- The method returns
trueon success,falseon failure — always check the return value - Child records with reference fields may prevent deletion — check for foreign key constraints
Most ServiceNow tables don't maintain deletion audit trails. Once deleteRecord() succeeds, the data is gone forever. Test deletion logic thoroughly in development before deploying to production.
Enjoying this? Get one deep-dive per week.
Join 1,000+ ServiceNow pros — scripts, GlideRecord patterns, Flow Designer techniques, and career moves. Free.