ServiceNow Tools · LessonReviewed by Praveen T, ServiceNow Trainer, 9 yrs · Updated · Published · current release · utility
ServiceNow Background scripts
Run server-side script on demand, carefully.
Quick answer
Scripts - Background runs server-side JavaScript on a ServiceNow instance the moment you submit it, against real data, with no save step in between. Treat it as dangerous: test on a sub-production instance first, read before you write, comment out update() and deleteRecord() until the affected set is verified with gs.info(), and batch large operations with setLimit().
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:
Try it YourselfJavaScript
▸ Press Run to execute.
Runs in a sandbox in your browser. Mock gs and GlideRecord and sample data are provided.
Practise this on your own free instance.