Book Image

ServiceNow Application Development

By : Sagar Gupta
Book Image

ServiceNow Application Development

By: Sagar Gupta

Overview of this book

ServiceNow provides service management for every department in the enterprise, including IT, Human Resources, Facilities, Field Service, and more. This book focuses on all the steps required to develop apps and workflows for any of your business requirements using ServiceNow. You will start with the first module, which covers the basics of ServiceNow and how applications are structured; how you can customize the dashboard as required; and also how to create users. After you get used to the dashboard, you will move on to the next module, Applications and Tables, where you will learn about working with different tables and how you can create a scope other than the global scope for your application. The next module is Scripting and APIs, where you will learn Scripting in ServiceNow and use powerful APIs to develop applications. The final module, Administration Essentials, covers debugging, advanced database features, and scheduled script creation. By the end of the book you will have mastered creating organized and customer-friendly applications
Table of Contents (21 chapters)
Title Page
Credits
About the Author
About the Reviewer
www.PacktPub.com
Customer Feedback
Preface
Free Chapter
1
Introduction to ServiceNow

Script actions


Script actions are server-side JavaScript code that is executed when an event it is listening to is triggered on the specified table. Just like any other server-side script, script actions have access to all the server-side glide APIs, script includes, and other server-side resources.

The following steps show you how to create a script action:

  1. Open the Create New Application File wizard in Studio, select Server Development | Script Action, and click on the Create button.
  2. Fill in the new script action record form with the following values:
    • Name: Update Reassignment Count
    • Event: x_8940_travel_book.assigned_to_changed
    • Active: Checked
    • Script: (Use the following mentioned code)
  1. Write the following code in the script field:
        current.reassignment_count += 1; 
        current.update(); 

In the preceding code, we are incrementing the reassignment_count field by 1 and then updating the record. The system usually takes a few seconds to update the record because the control is returned...