Book Image

Mastering ServiceNow Scripting

By : Andrew Kindred
Book Image

Mastering ServiceNow Scripting

By: Andrew Kindred

Overview of this book

Industry giants like RedHat and NetApp have adopted ServiceNow for their operational needs, and it is evolving as the number one platform choice for IT Service management. ServiceNow provides their clients with an add-on when it comes to baseline instances, where scripting can be used to customize and improve the performance of instances. It also provides inbuilt JavaScript API for scripting and improving your JavaScript instance. This book will initially cover the basics of ServiceNow scripting and the appropriate time to script in a ServiceNow environment. Then, we dig deeper into client-side and server-side scripting using JavaScipt API. We will also cover advance concepts like on-demand functions, script actions, and best practices. Mastering ServiceNow Scripting acts as an end-to-end guide for writing, testing, and debugging scripts of ServiceNow. We cover update sets for moving customizations between ServiceNow instances, jelly scripts for making custom pages, and best practices for all types of script in ServiceNow. By the end of this book, you will have hands-on experience in scripting ServiceNow using inbuilt JavaScript API.
Table of Contents (18 chapters)
Title Page
Packt Upsell

Event management

Events that trigger different outcomes in an instance run in ServiceNow. An event can be invoked from any script on the server side. The main outcome from an event being triggered is either a notification or a script action. Notifications are usually emails, and we will take a look at script actions later on in this chapter.

First of all, to trigger an event, the event will need to be defined. To define an event, we can navigate to System Policy | Events | Registry and click on the New button. Upon doing this, we are given the form shown in Figure 6.4:

Figure 6.4: New event form

In the form, we need to give the event a name. Event names are usually words split by full stops and underscores, and if you look at the list of events, you will see the general format used for events. It is also good practice to fill in the table field for reference. The Fired by and Description fields are simple text fields, but it is a good idea to fill these in with details of when the event should...