Running background scripts
The simplest place to experiment with server-side scripting is perhaps the Background Scripts section in ServiceNow. This provides you with a large text box in which you place your code and a button saying Run Script
, without any fuss, formatting, or further complexity. Outputs from your session during execution (such as log statements) are captured and presented to the screen. This, therefore, provides an excellent place to run server-side code where you need to monitor the results, where you can experiment, or where you need to run one-off scripts.
Navigate to Background Scripts
by going to System Definition
> Scripts (Background)
.
You will be presented with a large script box; however, before you get too enthusiastic, heed the warning shown. The reason that accessing background scripts requires elevated privileges is to remind you that some badly written code can, in fact, delete all your data. Never experiment in a live production instance!
Note
Inefficient...