ServiceNow Application Development
By Sagar Gupta
()
About this ebook
Develop and extend efficient cloud-native applications with ServiceNow
About This Book- Build and customize your apps and workflows to suit your organization's requirements
- Perform in-depth application development from designing forms to writing business rules, client-scripts, and workflows
- Comprehensive guide to the end-to-end implementation of designing and extending apps with ServiceNow
If you are a ServiceNow administrator and developer and need to build and customize your service management solution (apps and workflows) with ServiceNow, then this book is for you.
What You Will Learn- Customize the ServiceNow dashboard to meet your business requirements
- Use Administration and Security Controls to add roles and ensure proper access
- Manage tables and columns using data dictionaries
- Learn how application scopes are defined within ServiceNow
- Configure different types of table to design your application
- Start using the different types of scripting options available in ServiceNow
- Design and create workflows for task tables
- Use debugging techniques available in ServiceNow to easily resolve script-related issues
- Run scripts at regular time intervals using the Scheduled Script Execution module
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
Style and approachA step-by-step tutorial to designing applications and workflows with ServiceNow
Related to ServiceNow Application Development
Related ebooks
Mastering ServiceNow Scripting: Leverage JavaScript APIs to perform client-side and server-side scripting on ServiceNow instances Rating: 0 out of 5 stars0 ratingsSoftware Architect's Handbook: Become a successful software architect by implementing effective architecture concepts Rating: 0 out of 5 stars0 ratingsAWS Security Cookbook: Practical solutions for securing AWS cloud infrastructure with essential services and best practices Rating: 0 out of 5 stars0 ratingsAWS FinOps Simplified: Eliminate cloud waste through practical FinOps Rating: 0 out of 5 stars0 ratingsWinthrop Rockefeller: From New Yorker to Arkansawyer, 1912-1956 Rating: 0 out of 5 stars0 ratingsTerraform Cookbook: Provision, run, and scale cloud architecture with real-world examples using Terraform Rating: 0 out of 5 stars0 ratingsITSM Tools A Complete Guide - 2021 Edition Rating: 0 out of 5 stars0 ratingsApplied Architecture Patterns on the Microsoft Platform Second Edition Rating: 0 out of 5 stars0 ratingsDeploying AI in the Enterprise: IT Approaches for Design, DevOps, Governance, Change Management, Blockchain, and Quantum Computing Rating: 0 out of 5 stars0 ratingsEnterprise API Management: Design and deliver valuable business APIs Rating: 3 out of 5 stars3/5Comprehensive Guide for CISSP, CISA, CISM, GSEC. SSCP Certification Exams Rating: 0 out of 5 stars0 ratingsOpenStack Essentials - Second Edition Rating: 0 out of 5 stars0 ratingsStorage area network The Ultimate Step-By-Step Guide Rating: 0 out of 5 stars0 ratingsData replication Complete Self-Assessment Guide Rating: 0 out of 5 stars0 ratingsCloud Computing Basics: A Non-Technical Introduction Rating: 0 out of 5 stars0 ratingsModern Data Center A Complete Guide - 2020 Edition Rating: 0 out of 5 stars0 ratingsCloud Computing: Assessing the risks Rating: 0 out of 5 stars0 ratingsMicrosoft Azure A Complete Guide - 2021 Edition Rating: 0 out of 5 stars0 ratingsNavigating Azure: A Comprehensive Guide to Microsoft's Cloud Platform Rating: 0 out of 5 stars0 ratingsDisruptive Cloud Computing and It: Cloud Computing Simplified for Every It Professional Rating: 0 out of 5 stars0 ratingsCloud computing Complete Self-Assessment Guide Rating: 0 out of 5 stars0 ratingsIPaaS A Complete Guide - 2020 Edition Rating: 0 out of 5 stars0 ratingsThe Five Dimensions of Sourcing Value Rating: 0 out of 5 stars0 ratingsThe Evolution of Cloud Computing: How to plan for change Rating: 0 out of 5 stars0 ratingsAmazon Redshift Complete Self-Assessment Guide Rating: 0 out of 5 stars0 ratingsData Science Solutions on Azure: Tools and Techniques Using Databricks and MLOps Rating: 0 out of 5 stars0 ratings
Programming For You
Coding All-in-One For Dummies Rating: 4 out of 5 stars4/5Excel : The Ultimate Comprehensive Step-By-Step Guide to the Basics of Excel Programming: 1 Rating: 5 out of 5 stars5/5Learn to Code. Get a Job. The Ultimate Guide to Learning and Getting Hired as a Developer. Rating: 5 out of 5 stars5/5SQL QuickStart Guide: The Simplified Beginner's Guide to Managing, Analyzing, and Manipulating Data With SQL Rating: 4 out of 5 stars4/5Learn PowerShell in a Month of Lunches, Fourth Edition: Covers Windows, Linux, and macOS Rating: 5 out of 5 stars5/5Linux: Learn in 24 Hours Rating: 5 out of 5 stars5/5HTML & CSS: Learn the Fundaments in 7 Days Rating: 4 out of 5 stars4/5Python Data Structures and Algorithms Rating: 5 out of 5 stars5/5SQL All-in-One For Dummies Rating: 3 out of 5 stars3/5Python Programming : How to Code Python Fast In Just 24 Hours With 7 Simple Steps Rating: 4 out of 5 stars4/5Excel 101: A Beginner's & Intermediate's Guide for Mastering the Quintessence of Microsoft Excel (2010-2019 & 365) in no time! Rating: 0 out of 5 stars0 ratingsJavaScript All-in-One For Dummies Rating: 5 out of 5 stars5/5HTML in 30 Pages Rating: 5 out of 5 stars5/5C Programming For Beginners: The Simple Guide to Learning C Programming Language Fast! Rating: 5 out of 5 stars5/5Narrative Design for Indies: Getting Started Rating: 4 out of 5 stars4/5Python: For Beginners A Crash Course Guide To Learn Python in 1 Week Rating: 4 out of 5 stars4/5Python: Learn Python in 24 Hours Rating: 4 out of 5 stars4/5Beginning Programming with C++ For Dummies Rating: 4 out of 5 stars4/5Raspberry Pi Electronics Projects for the Evil Genius Rating: 3 out of 5 stars3/5C All-in-One Desk Reference For Dummies Rating: 5 out of 5 stars5/5Coding with JavaScript For Dummies Rating: 0 out of 5 stars0 ratings
Reviews for ServiceNow Application Development
0 ratings0 reviews
Book preview
ServiceNow Application Development - Sagar Gupta
ServiceNow Application Development
Transform the way you build apps for enterprises
Sagar Gupta
BIRMINGHAM - MUMBAI
ServiceNow Application Development
Copyright © 2017 Packt Publishing
All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews.
Every effort has been made in the preparation of this book to ensure the accuracy of the information presented. However, the information contained in this book is sold without warranty, either express or implied. Neither the author, nor Packt Publishing, and its dealers and distributors will be held liable for any damages caused or alleged to be caused directly or indirectly by this book.
Packt Publishing has endeavored to provide trademark information about all of the companies and products mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot guarantee the accuracy of this information.
First published: September 2017
Production reference: 1210917
Published by Packt Publishing Ltd.
Livery Place
35 Livery Street
Birmingham
B3 2PB, UK.
ISBN 978-1-78712-871-2
www.packtpub.com
Credits
About the Author
Sagar Gupta is the chief software architect and founder of Eworks Services Pvt. Ltd., central India's first ISO 27001-certified firm.
He leads a team of 50+ ServiceNow, BMC Remedy, AEM, Cloud, and BigData experts. He started his career building custom enterprise and service management applications in 2003 and has been working on the ServiceNow platform since the past 7 years. He has in-depth knowledge of the platform ranging from ITSM and ITOM to GRC, Security Operations, HR, Field Service, and IT Business Management.
Over the past several years, he has consulted numerous companies and conducted over 200 training sessions for Fortune 500 organizations such as GE, Dell, NetApp, IBM, Cognizant, Sapient, HCL, and EMC2.
He is also the lead engineer in the SnowEditor project and currently devotes most of his time helping companies improve their IT service delivery, modernize ITSM, automate processes, and build cloud-native applications on ServiceNow.
About the Reviewer
Manoj Jain is a technical architect and has over 10 years of IT experience. He has immense knowledge of ITSM processes and platforms, such as ServiceNow and BMC Remedy.
He is certified in ITIL V3 Foundation and ServiceNow System Administrator. He has conducted over 50 training in past 7 years in ITIL, BMC Remedy and ServiceNow for clients such as GE, Cognizant, CSS Corp, and Persistent.
During his career, he has consulted more than 100 clients to implement better ITSM solutions using ServiceNow and BMC Remedy. He is currently focused on helping companies create better custom applications on cloud platforms such as ServiceNow.
www.PacktPub.com
For support files and downloads related to your book, please visit www.PacktPub.com. Did you know that Packt offers eBook versions of every book published, with PDF and ePub files available? You can upgrade to the eBook version at www.PacktPub.com and as a print book customer, you are entitled to a discount on the eBook copy. Get in touch with us at service@packtpub.com for more details. At www.PacktPub.com, you can also read a collection of free technical articles, sign up for a range of free newsletters and receive exclusive discounts and offers on Packt books and eBooks.
https://www.packtpub.com/mapt
Get the most in-demand software skills with Mapt. Mapt gives you full access to all Packt books and video courses, as well as industry-leading tools to help you plan your personal development and advance your career.
Why subscribe?
Fully searchable across every book published by Packt
Copy and paste, print, and bookmark content
On demand and accessible via a web browser
Customer Feedback
Thanks for purchasing this Packt book. At Packt, quality is at the heart of our editorial process. To help us improve, please leave us an honest review.
If you'd like to join our team of regular reviewers, you can email us at customerreviews@packtpub.com. We award our regular reviewers with free eBooks and videos in exchange for their valuable feedback. Help us be relentless in improving our products!
Table of Contents
Preface
What this book covers
What you need for this book
Who this book is for
Conventions
Reader feedback
Customer support
Errata
Piracy
Questions
Introduction to ServiceNow
Creating a developer account
Requesting a new ServiceNow instance
Logging in to your instance
Understanding the ServiceNow platform user interface
Components of the user interface
System settings
Navigating through applications
Module UIs
Form UIs
Related List UI
Dot-walking
Service Management applications
ServiceNow application architecture
Single architecture
Shared resources
Single data model
Advanced High Availability architecture
Summary
User Administration
Creating a new user
Things to consider when creating a user
Creating a new group
Creating a new role
Associating a user to one or more groups
Assigning a role to a group
Best practices for managing groups
Task assignments
Approvals
Security
E-mail notifications
Impersonating a user
Companies, locations, and departments
Adding a department
Associating a user with a department
Managing user sessions
Terminating sessions of a logged in user
Locking out a user
Marking a user as inactive
Summary
Data Management
Database structure
Key table-management modules
Tables & Columns
Schema map
Tables
Columns and rows
Dictionary
Creating a table
Adding columns to table
Modifying column properties
Task table
Extending the Task table
Configuration management table
Extending the configuration table
Summary
Application Scopes
Application architecture
Structure of an application
Application scope
Private application scope
Global scope
Application versions
Application tables
Application dependencies
Application files
Fix scripts
ServiceNow applications
Application picker
Creating a new application
Creating application artifacts
Accessing information in different scopes
All application scopes
This application scope only
Summary
Modules, Forms, and Views
Creating a new module
Using Studio
Different module link types
New records
Running a report
Homepages
Portal pages
Change layout
Add content
Homepage modules
Separators
Managing module order
Summary
Introduction to ServiceNow Scripting
Different script types
Client-side scripts
Server-side scripts
Execution order of scripts
Client-side Glide API
GlideForm
GlideUser
GlideMenu
GlideList2
GlideDialogWindow
Using the GlideDialogWindow class
GlideAjax
Server-side Glide API
GlideRecord
addQuery
Available query operators
addNullQuery
addNotNullQuery
Applying multiple queries
Applying an OR query
Iterating over query records
GlideSystem
getCurrentScopeName()
log()
logError()
logWarning()
nil()
now()
print()
addInfoMessage()
addErrorMessage()
isInteractive()
isLoggedIn()
getUserID()
getUserName()
getUserNameByUserID()
eventQueue()
Scripting in scoped applications
Summary
Client-Side Scripting
Client scripts
onLoad client scripts
onChange client scripts
onSubmit client scripts
UI policies
UI scripts
Disabling client-side scripts
Creating a scope UI script
Summary
Server-Side Scripting
Business rules
Checking the booking requests by the same caller
When to execute business rules
Preventing recursive business rule execution
The scope problem
Script includes
UI actions
Summary
Jelly Scripting
Jelly scripts
Namespaces and phases
Jelly tags
j:if tag
j:choose, j:when, and j:otherwise
j:set
The j:set_if tag
The j:while tag
Glide tags
g:evaluate
g:breakpoint
g:macro_invoke
g:ui_form
g:ui_input_field and g:checkbox
g:dialog_buttons_ok_cancel
g:ui_reference
g:insert
g:inline
g:function and g:call
Special characters in Jelly
Ampersand--&
AND--&&
LESS THAN--<
Whitespace
Space
UI pages
Processing script
UI macros
UI formatters
Summary
Events and Notifications
Events
Registering events
Using a business rule to trigger events
Checking event logs
Script actions
Notifications
Testing notifications
Previewing notifications
Forward outgoing e-mails
Updating a travel-booking request
Summary
Workflow Development
Workflow basics
Using workflow editor
Workflow actions menu
Workflow development state
Workflow properties
Workflow transitions and activity exit conditions
Adding exit conditions
Adding activities to a workflow
Removing an activity from a workflow
Validating a workflow
Workflow activities
Approval and rollback activities
Condition workflow activities
Workflow notification activities
Subflow activity
Task activities
Timer activity
Utility workflow activities
REST calls using a workflow
Defining a REST endpoint
Making a REST request using a workflow
Summary
Debugging in ServiceNow
Syntax editor
Context-sensitive help
Syntax editor keyboard shortcuts
Scripting assistance
Period (.) key
Open parenthesis
Toggle full screen mode
Start search
Find next
Find previous
Replace
Replace all
Syntax editor macros
Available macros
Creating a custom macro
Script syntax error checking
Script Debugger
Launching Script Debugger
Script Debugger interface
Parts of Script Debugger
Debugging code
JavaScript Log
JavaScript Log window interface
Using jslog()
Difference between console.log() and jslog()
Field Watcher
Summary
Advanced Database Features
Relationships
Creating a new relationship
Configuring forms to show related lists
Modifying the list control options
Dictionary override
Database indexing
Full-text search
Table auditing
Excluding a field from being audited
Restoring deleted records
Limitations of the undelete feature
Database rotation
Data archiving
Creating an archive rule
Creating a destroy rule
Summary
Job Scheduling and Data Export-Import
Scheduled script execution
Exporting data
Form export
List export
Direct URL access
sysparam_view
sysparm_query
sysparm_record_count
sysparm_order_by
Building queries using a list of records filters
Export limits
Importing data using Import Sets
Importing data using CSV
Import set table
Checking the import log
Creating the transform map
Changing Field Map properties
Scripting to override field values
Transform map scripts
Running the transform
Monitoring transform progress
Summary
Preface
ServiceNow Application Development will focus on in-depth application development from designing forms to write business rules and client scripts to designing workflows on the world’s fastest growing enterprise cloud platform. Global organizations such as GE, NASA, Intel, and Dell EMC are using the ServiceNow platform to quickly build enterprise-ready custom applications that run on the cloud. GE Capital, the financing arm of GE, delivers financial, intellectual, and human capital to its customers, around the world and to meet growing challenges they used ServiceNow to build a new cloud-ready Risk Vulnerability Assessment Tool (RVAT) in only six weeks. This developer-focused book will serve as a road map for you and your team on how to build cloud-ready applications, manage data in single system of record, build standard-based applications, and win customers' and IT users' satisfaction.
What this book covers
Chapter 1, Introduction to ServiceNow, will help the reader get started with ServiceNow and gain access to a free developer instance from ServiceNow Developer Portal. The chapter is focused on getting the reader used to the platform and the basics of ServiceNow, such as UI, Login process, and some out-of-the box applications and features. The chapter will also help the reader brush up their knowledge about how ServiceNow is used within organizations.
Chapter 2, User Administration, explains how to create new users and associate them to a group. You will also learn how to assign roles to groups and users. Further, you will learn how to impersonate a user to test if our newly created users have access to correct applications and modules.
Chapter 3, Data Management, explains that managing tables and columns is one of the most common job administrators and developers have to perform when working on the ServiceNow platform. ServiceNow platform features various modules that can be used to create and manage tables and columns. In this chapter, you will learn how to create a new table from scratch, extend existing table and add fields (or columns) to new or existing tables. You will also understand the structure of existing tables such as task and cmdb.
Chapter 4, Application Scopes, explains that, when developing applications on the ServiceNow platform, developers need to take special care about the application scope they are working on. Applications help administrators and developers to combine different modules and features to deliver a relevant set of functionality. ServiceNow allows developers and administrators simple means to create and manage applications. In this chapter, you will learn how to create new applications. You will learn about the relationship between applications and scopes. You will also learn how to use applications to associate relevant information and access data from other applications.
Chapter 5, Modules, Forms, and Views, explains that ServiceNow platform easy-to-use features that allow administrators to create modules, and customize form and views. In this chapter, you will learn how to create different type of modules, customize the form layout, and quickly add new form fields to the table. You will also learn about various form field element types available in the platform including the reference field, journal field, date field and choice list. Furthermore, you will learn how to use form views to present same record in different manner to end-users based on their role.
Chapter 6, Introduction to ServiceNow Scripting, ServiceNow platform offers various scripting options to developers. This chapter, you will learn about different type of scripting options available in ServiceNow platform. You will learn about difference between server-side and client-side scripts. Furthermore, you will also learn how scripting works in scoped applications and get introduced to client-side and server-sideGlide APIs.
Chapter 7, Client-Side Scripting, will help you to learn how to create client-side scripts and what are the different ways to execute the client-side code. The readers will learn how to make use of the client-side Glide API and some of the most widely used functions available. You will learn how to create client scripts, UI policy, and UI script.
Chapter 8, Server-side Scripting, explains that server-side scripts and APIs can be employed to enhance server-side data processing and integration with different systems. Server-side scripts can also be used to perform database operations and perform large scripted imports. This chapter will help you learn how to create server-side scripts, and when and where the server side scripts comes in the scene when working with ServiceNow applications. The chapter will help you understand how to make use of the server-side Glide API and server-side artifacts like Business Rules, script-include, and data policy.
Chapter 9, Jelly Scripting, explains that in ServiceNow platform, Apache’s Jelly syntax is used to render forms and UI pages. Jelly is Java and XML-based scripting and a transformation engine used to turn XML into executable code. The output is usually HTML and JavaScript code that is used by the browser to render elements on a page. This chapter will help you learn how to create UI pages, UI macros and formatters. You will learn how to make use of Jelly scripts to enhance our UIs and create custom controls and application property page.
Chapter 10, Events and Notifications, explains that in ServiceNow, Events are used to monitor changes or events by event handlers just like in any other programming language. Events in the queue are consumed by script actions or notifications, which in turn execute scripts or trigger notifications. Notification on the other hand, is an approach to send out e-mail to the end-users or external end-points. Any form or script sending out an email relies on the Notification feature of the platform. This chapter will help you learn how to trigger events when data changes and send out e-mail based on events.
Chapter 11, Workflow Development, explains that the ServiceNow offers a web based visual workflow designer known as Workflow Editor. A workflow is made up of activities and always consists of begin and end activities that marks the start and end of the workflow. This chapter will help you learn how to use many of the different available standard workflow activities including the REST activity and how to design, run and test your own workflow.
Chapter 12, Debugging in ServiceNow, explains that within ServiceNow you write both server-side and client-side code. The ways to troubleshoot them more or less remain same but the approach differs. This chapter will cover many different troubleshooting and debugging techniques available within the platform. The chapter will help you how to use many features to debug and troubleshoot scripts in ServiceNow platform and cover various topics such as Syntax editor, launching and using the Script debugger, JavaScript log and Field watcher.
Chapter 13, Advanced Database Features, ServiceNow platform offers many features to improve the performance and overall functionalities of ServiceNow applications. This chapter will cover features like relationships, indexing, full-text search, and overriding field properties. You will also learn features such as enabling auditing, restoring deleted records and Table rotation and data archiving.
Chapter 14, Job Scheduling and Data Export-Import, explains that as a developer you will always to be tasked to ensure data from various external systems can be brought into the platform with ease and this may require you to create scripted controls that can perform pre- and post-processing of the imported data. This chapter includes some of advanced development and administrative tasks that a developer must be aware of like scheduled script execution (SSE), and data export and import. More specifically, you will help how to schedule a script to run in the background, export data, import data using import sets, configure transform maps and use scripts to process imported data.
What you need for this book
As ServiceNow is a cloud-based SaaS application, it can be accessed using most standard browsers. These are browsers that are supported by the UI16 of the ServiceNow application:
Chrome
Version: Latest public release
Firefox
Version: Latest public release
Internet Explorer
Version: 9 and above
Microsoft Edge
Version: Latest public release
Apple Safari
Version: 9.1 and above
There are some limitations when using Internet Explorer to access ServiceNow, including the following:
Compatibility mode is not supported
Setting security to High using Internet Options | Security tab is not supported and will make some ServiceNow applications and features inaccessible
Internet Explorer 11 may face memory leak issues especially in Windows 7
Notifications in Connect are only available in Safari, Chrome and Firefox. Internet Explorer doesn’t support notification feature.
Cookies must be enabled for the login feature to work. If you disable cookies, you will not be able to log in to the instance.
Who this book is for
This book is indented for anyone who wants to learn how to develop software on the world's fastest growing enterprise cloud platform. Developers and administrator, who are already working on ServiceNow, can also use this book to brush up their knowledge of key development features.
Conventions
In this book, you will find a number of styles of text that distinguish between different kinds of information. Here are some examples of these styles, and an explanation of their meaning.
Code words in text, database table names, folder names, filenames, file extensions, pathnames, dummy URLs, user input, and Twitter handles are shown as follows: The g_user global object can be used to retrieve user session information in client scripts.
A block of code is set as follows:
function DemoCallBack(response) {
//javascript code
var answer = response.responseXML.documentElement.getAttribute(answer
);
console.log(answer);
}
New terms and important words are shown in bold. Words that you see on the screen, in menus or dialog boxes for example, appear in the text like this: Navigate to the bottom of the page and click on the New button in the Database Indexes related list.
Warnings or important notes appear in a box like this.
Tips and tricks appear like this.
Reader feedback
Feedback from our readers is