Fix scripts
Quick answer
A fix script is a server-side script designed to run once to correct or migrate data, and, crucially, to be captured in an update set so it runs automatically when your work is promoted to the next instance. It is the disciplined alternative to pasting code into background scripts in production.
Key takeaways
- Fix script vs background script
- A safe fix script
- Run tracking
- Try it Yourself
A fix script is a server-side script designed to run once to correct or migrate data, and, crucially, to be captured in an update set so it runs automatically when your work is promoted to the next instance. It is the disciplined alternative to pasting code into background scripts in production.
Fix script vs background script
A safe fix script
setLimit to batch, and decide deliberately whether to call setWorkflow(false), skipping business rules can be right for a migration but wrong if downstream automation must fire.Run tracking
Fix scripts record whether they have already run, so promotion won't double-apply them. Mark them clearly and remove or disable after they've served their purpose.
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
A fix script is captured in...
- A. Update sets, so it promotes with your work
- B. Nothing
- C. A separate database
Show answer
A. Update sets, so it promotes with your work
Fix scripts travel in update sets and run on promotion.
Compared to a background script, a fix script is...
- A. Tracked and re-runnable
- B. Faster to type only
- C. Never saved
Show answer
A. Tracked and re-runnable
Fix scripts are saved, auditable and re-runnable.
Before running a fix script you should...
- A. Test in a sub-prod instance and batch it
- B. Run straight in prod
- C. Delete the table
Show answer
A. Test in a sub-prod instance and batch it
Test first and use setLimit to batch changes.