Background scripts
Quick answer
Scripts - Background runs server-side JavaScript immediately. Powerful and dangerous, it writes to real data.
Scripts - Background runs server-side JavaScript immediately. Powerful and dangerous, it writes to real data.
- Always test on a sub-production instance first.
- Read before you write, comment out
update()/deleteRecord()until verified. - Use
gs.info()to confirm the affected set. - Batch large operations with
setLimit().
Try the read-only version below safely in the sandbox:
Want to learn this properly?
Our live, instructor-led ServiceNow Training covers this hands-on, with real projects and a certification path.
Check your understanding
Before writing, what should you do in a background script?
- A. Preview with a read-only query
- B. Delete everything
- C. Grant admin
Show answer
A. Preview with a read-only query
Confirm the affected set before writing.
Where should you test first?
- A. Sub-production
- B. Production
- C. A client script
Show answer
A. Sub-production
Never run untested background scripts in production.
Frequently asked questions
What does the term Background scripts refer to in ServiceNow?
Scripts - Background runs server-side JavaScript immediately. Powerful and dangerous, it writes to real data.