IT CanvassTalk to an advisor
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.
Set up your free instance →
Already working on ServiceNow and stuck on a live ticket?Get an expert ServiceNow developer on screen-share to finish your daily tasks with you. Deliver on time, protect your reputation and your job. Monthly support only, no task-wise plans.Task assigned · no idea where to startStill stuck · your job on the lineExpert joins your screenDelivered on timeExplore On Job Support