Working with background scripts
A background script is a place where you can test your server-side scripts, which is same as free text box. To access the background script, you should have a security_admin
role with elevated privileges.
Getting ready
To step through this recipe, you should have an active Service-Now instance, valid credentials, and a security admin role.
How to do it...
- Open any standard web browser and type the instance address.
- On the left-hand side, type
background
in the search box and Service-Now will search the module for you. - Click on the
Scripts
-
Background
module underSystem Definition
application, as shown here:
Background script module
- Now you will be able to see the following screen, where you can place your code and click on the
Run
script
button:
Run script
- Service-Now has an inbuilt
gs.print()
function, which is used to view the output of the script and it also write an entry in a log file, but thegs.log ()
functions in write an entry in the system log and log file...