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
Contributors
Preface
Index

Configuration versus customization


ServiceNow instances are complex. There are a great many ways in which they can be changed, and often, there are several ways to achieve the same goal using different techniques. These changes can be done through configuration and customization.

Configuration uses the ServiceNow interface to set up rules, conditions, and other configurations, like global system properties and filters. This is often made by using a series of drop-down lists.

We can see an example of this in a business rule as follows:

Figure 1.1: Configuration example from a business rule

In Figure 1.1 we can see filter conditions and and the values to set based on the filter. This configuration example uses no code and is preferable to customization. This type of filtering is seen across the ServiceNow platform.

Most system administrators will be able to administer their instance with configuration alone. A configured instance will suffice for a certain level of functionality on an instance, and, if you are trying to achieve a goal where configuration is available, it is usually the best option.

Customization is when an administrator uses scripts to allow an instance to perform further tasks beyond what configuration can do alone. ServiceNow is extremely open-ended, and the ability to write scripts at multiple points when loading and submitting forms makes it very versatile.

A customization might be to write a script to add a date validation on a field and show a message or clear the field if an incorrect value is entered. Custom scripts are to be managed by the creator, as ServiceNow is not responsible for the code. Therefore, if you start to move into the customization route, make sure you know what you are doing.

As the creator will need to maintain the script created, they will also need to ensure that it will still function when an instance of ServiceNow is upgraded.

Note

If customizing an existing ServiceNow script, rather than customizing the script itself, copy it, rename the copied script, and deactivate the existing script. Then you can make as many changes to the new copied script as you like, while having the original backed up in case it is needed.