ServiceNow's copy() method is the cleanest way to duplicate records because it handles field type conversions and complex field copying automatically. The common mistake is copying system fields like sys_id or workflow state, which corrupts the new record. Always call newRecord() before copy() to ensure proper record initialization and let ServiceNow generate new system field values.
When to use this
- When creating template-based records where most fields should match an existing record
- When duplicating incidents, requests, or change records for similar work
- When you need to preserve complex field values like journal entries or encrypted fields
- When copying records with many custom fields where manual field enumeration is error-prone
When NOT to use this
- Don't use in client scripts — use GlideAjax to call a server-side Script Include instead
- Don't copy records with active workflow states — reset workflow fields explicitly
- Don't use when you only need a few fields — manual field assignment is clearer
- Don't copy attachments automatically — they'll reference the original record
Key behaviors and gotchas
- The
copy()method copies ALL fields including system fields — you must override unwanted values - Journal fields get copied as-is — override
work_notesandcommentsto avoid confusion - Auto-generated fields like
numberget copied — set to empty string to trigger new generation - Reference fields maintain their original values — verify these are appropriate for the copy
- Business rules fire on the copied record — ensure your rules handle duplicate scenarios
- ACLs apply to both read (source) and write (target) operations — the copy may fail silently
Never copy records without explicitly setting the number field to empty string. ServiceNow will create a duplicate number, breaking your numbering sequence and causing user confusion when they see two incidents with the same number.
Enjoying this? Get one deep-dive per week.
Join 1,000+ ServiceNow pros — scripts, GlideRecord patterns, Flow Designer techniques, and career moves. Free.