Servicenow Cookbook 2nd PDF
Servicenow Cookbook 2nd PDF
Servicenow Cookbook 2nd PDF
Cookbook
Second Edition
John Benedetti
Ashish Rudra Srivastava
BIRMINGHAM - MUMBAI
ServiceNow Cookbook Second
Edition
Copyright © 2018 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 authors, nor Packt Publishing or its dealers and distributors, will be held
liable for any damages caused or alleged to have been 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.
ISBN 978-1-78883-405-6
www.packtpub.com
mapt.io
Mapt is an online digital library that gives you full access to over 5,000
books and videos, as well as industry leading tools to help you plan your
personal development and advance your career. For more information,
please visit our website.
Why subscribe?
Spend less time learning and more time coding with practical
eBooks and Videos from over 4,000 industry professionals
Improve your learning with Skill Plans built especially for you
When he's not working, he enjoys cooking and goes on new adventures
with his wife Karla and indoctrinating his children Gabriel and Catelyn in
The Ways of the Force, The Natural 20, and There's Always Next Year.
I must thank my wife Poonam, who has endured with my late-night work
and book reviewing sessions; her patience and understanding have helped
me to deliver on my commitments in time. Lots of love to my 5 years old
superkid Varad, who refreshed me with his energetic activities, kiddy
fights, and brilliant questions, especially in low times.
What this book covers
, Getting Started with ServiceNow, will focus on provisioning your
Chapter 1
Conventions used
Sections
Getting ready
How to do it…
How it works…
There's more…
See also
Get in touch
Reviews
Introduction
First steps with ServiceNow application
Getting ready
How to do it...
There's more...
See also
Getting ready
How to do it...
How to do it...
Tables
Records
ACLs
Workflow Editor
See also
How to do it...
Request Management
Incident Management
Change Management
Problem Management
Knowledge Management
See also
How to do it...
User profile
Notifications
Impersonation
See also
Introduction
Setting up your basic configuration
Getting ready
How to do it...
See also
How to do it...
There's more...
See also
Getting ready
How to do it...
See also
Getting ready
How to do it...
See also
Getting ready
How to do it...
See also
Getting ready
How to do it...
See also
How to do it...
There's more...
See also
Getting ready
How to do it...
See also
Getting ready
How to do it...
See also
Getting ready
How to do it...
See also
Getting ready
How to do it...
There's more...
See also
3. Building and Designing Data-Driven Applications
Introduction
Starting a new application
Getting ready
How to do it...
See also
Getting ready
How to do it...
See also
Getting ready
How to do it...
There's more...
See also
Getting ready
How to do it...
See also
How to do it...
There's more...
See also
Getting ready
How to do it...
There's more...
See also
Getting ready
How to do it...
There's more...
See also
Getting ready
How to do it...
There's more...
See also
Getting ready
How to do it...
There's more...
See also
Introduction
Setting up email notifications for users
Getting ready
How to do it...
See also
Getting ready
How to do it...
See also
Getting ready
How to do it...
See also
Getting ready
How to do it...
See also
Email troubleshooting
Getting ready
How to do it...
See also
Configuring delegates
Getting ready
How to do it...
See also
Introduction
How to view and run reports
Getting ready
How to do it...
See also
Getting ready
How to do it...
See also
Getting ready
How to do it...
See also
Getting ready
How to do it...
See also
Creating a dashboard
Getting ready
How to do it...
See also
Getting ready
How to do it...
See also
Introduction
Setting up workflow conditions
Getting ready
How to do it...
See also
Setting up approval activities
Getting ready
How to do it...
See also
Getting ready
How to do it...
See also
Adding notifications
Getting ready
How to do it...
See also
Getting ready
How to do it...
See also
Getting ready
How to do it...
See also
How to use workflow utilities
Getting ready
How to do it...
See also
Introduction
Understanding auditing in ServiceNow
Getting ready
How to do it...
See also
Getting ready
How to do it...
There's more...
See also
Getting ready
How to do it...
There's more...
See also
How to do it...
See also
Session debugging
Getting ready
How to do it...
See also
Background scripts
Getting ready
How to do it...
See also
8. Service Portal
Introduction
Configuring a portal
Getting ready
How to do it...
See also
Getting ready
How to do it...
See also
Branding and themes
Getting ready
How to do it...
See also
Portal pages
Getting ready
How to do it...
See also
Portal widgets
Getting ready
How to do it...
See also
Getting ready
How to do it...
There's more...
See also
Introduction
Understanding Discovery
Getting ready
How to do it...
See also
Understanding Orchestration
Getting ready
How to do it...
See also
Service Mapping
Getting ready
How to do it...
See also
Cloud Management
Getting ready
How to do it...
See also
Getting ready
How to do it...
See also
Human Resources
Getting ready
How to do it...
See also
Edge Encryption
Getting ready
How to do it...
See also
Getting ready
How to do it...
See also
How to do it...
See also
Starting with the core configuration and management tasks, this book will
help you build data-driven apps, and it will also explore development best
practices. You will learn to set up email notifications for users and work
with the database view for reporting. Next, you will be building/designing
data-driven apps where you will learn to implement the new Automated
Testing Framework. You will also be guided through creating various
tasks from the workflow and also how to make the most of the workflow
utilities available in ServiceNow. Following this, you will learn about
Service Portal, new with Helinski, where you will learn how to configure
the portal, how to perform integrations with different cloud platforms, and
tips and tricks on using the portal effectively. Finally, you will learn to use
paid plugins such as Discovery, Orchestration, and Service Mapping.
By the end of this book, you will acquire immediately applicable skills to
address everyday problems encountered on the ServiceNow platform.
Who this book is for
If you are an IT professional or an administrator who has some experience
of working with ServiceNow already and are looking to solve regular or
unique problems that surface when using ServiceNow, then this book is
for you. It's advisable to have a basic level of administration experience
with ServiceNow. Familiarity with JavaScript is assumed.
To get the most out of this
book
ServiceNow is cloud-hosted enterprise-level application, so you only
require a standard browser (Internet Explorer/Firefox/Safari/Google
Chrome) to access it. Apart from your organization's ServiceNow
instance, you can claim your personal ServiceNow instance by registering
at this link https://developer.servicenow.com.
Download the color images
We also provide a PDF file that has color images of the
screenshots/diagrams used in this book. You can download it from https://
www.packtpub.com/sites/default/files/downloads/ServiceNowCookbookSecondEdition_Colo
.
rImages.pdf
Conventions used
There are a number of text conventions used throughout this book.
Bold: Indicates a new term, an important word, or words that you see
onscreen. For example, words in menus or dialog boxes appear in the text
like this. Here is an example: "Click Submit to save the workflow."
Errata: Although we have taken every care to ensure the accuracy of our
content, mistakes do happen. If you have found a mistake in this book, we
would be grateful if you would report this to us. Please visit www.packtpub.com
/submit-errata, selecting your book, clicking on the Errata Submission Form
link, and entering the details.
Piracy: If you come across any illegal copies of our works in any form on
the internet, we would be grateful if you would provide us with the
location address or website name. Please contact us at copyright@packtpub.com
with a link to the material.
Each module is extensible individually, and you can readily add your own
custom functions and solutions to address specific needs within your
business. Opportunities exist for independent consultants and developers
to share and publish their own applications using the ServiceNow Share
portal, as well as the ServiceNow Store, and the platform is specifically
postured to be lightweight and mobile-ready. So, where does our journey
begins? Our first recipe will focus on provisioning our own individual
instance of ServiceNow and getting accustomed to the environment.
First steps with ServiceNow
application
Customer adoption of the ServiceNow platform has been surging over the
past few years, but it's important to remember that each customer has its
own expectations of how the platform will be used and adopted. One
important design point to remember is that ServiceNow is intended to
facilitate the adoption of the Information Technology Infrastructure
Library (ITIL) practice framework. ITIL describes an integrated and
process-based best practice framework for managing IT services. The
recipes in this chapter will give you an overview of the ServiceNow
modules that implement the ITIL v3.0 framework.
Getting ready
To get the most out of ServiceNow, knowledge of JavaScript and basic
database concepts will help you greatly. Please keep in mind that as an
admin or developer, you are not allowed to directly access the database
layer, application layer, or hosts where the application runs. However,
there are powerful options to utilize client and server-side scripts and
REST and SOAP API activities, as well as a robust yet easy to use
business logic infrastructure.
How to do it...
ServiceNow offers a private developer instance to those who register on
the Developer Portal.
4. Currently, our sample data user Abel Tuter has no group or role
memberships. Let's add him to our new group. Select his name
and then click the right-arrow button. Then click Save.
You might think that the easiest way to do this is to simply assign
him the role, much like we did the group. However, from a long-
term perspective, it's easier to manage rights within ServiceNow by
pre-populating groups with the necessary roles. This saves a lot of
manual work with role assignments and also removes unnecessary
rights from individuals if they leave the group at a future date.
Roles: https://docs.servicenow.com/bundle/jakarta-platform-administration
/page/administer/roles/concept/c_Roles.html
Groups: https://docs.servicenow.com/bundle/jakarta-platform-administrati
on/page/administer/users-and-groups/concept/c_Groups.html
ServiceNow frontend
navigation
Now that we've gotten our feet wet with some ServiceNow basics, it's time
to take a step back and look at some of the components of the ServiceNow
interface.
Getting ready
When users log in to the system, they will usually be met with one of
several landing pages. Let's see what Abel Tuter gets now that he's an
ITIL user.
How to do it...
1. When Abel logs in to the system, he will have access to the ITIL
home page. This home page provides several useful visualizations
(commonly called widgets), such as work assigned to his new
group or to him individually. Also, it provides other useful
information, such as overdue tasks or tasks of critical priority:
What's cool about these home pages is that each user can edit them
to suit their own needs.
2. Let's say Abel isn't terribly concerned about items that aren't
associated with his group. He can modify his version of the home
page to remove items that he doesn't feel are relevant.
3. After Abel's done this a few times, he decides that he wants to add
an additional widget to help him keep track of incidents that have
been assigned to his group but haven't been assigned to an
individual for attention. To do this, click Add content.
5. Ahhh, much better! Now Abel has a simpler home page interface
that will display information relevant to him at the beginning of
each session.
The Nav Bar
Another important part of the user interface is the Nav Bar. The Nav Bar
allows users to filter available selections to find relevant modules.
Additionally, the Nav Bar allows users to favorite important modules for
later reference.
Let's say Abel wants to quickly find a link to add a new incident. He can
type Incident in the filter menu to narrow his available choices.
For even quicker navigation, any of the links in the Nav Bar can be
selected as a favorite by starring the link.
Now, when Abel wants to filter by favorites, he can select the Favorites
tab in the Nav Bar. We can now see the Incident - Create New link is
available without additional filtering.
The Service Portal
Now that we've spent some time navigating the native ServiceNow
application, we will take a moment to talk about the new Service Portal.
The Service Portal is a newer feature introduced in the Helsinki version of
ServiceNow. As per ServiceNow's knowledge base, the Service Portal is
once of the newer additions to the platform and a simple way to create
portals for end users. It is a portal framework that allows administrators to
build a mobile-friendly self-service experience for users. It interacts with
parts of the ServiceNow platform, so users can access specific platform
features using the Service Portal.
The base table of ITSM core processes is called task. All of the Core
ITSM applications share basic elements, like a unique identifier,
assignment elements like group and user, requester information like who
opened the task, and so on. It is a best practice that any new tables that fit
this module should extend the task table or something similar to avoid
duplication of efforts and redundancy/clutter in the database layer.
So, let's say we have a customer who wants to build a new type of task
called a Fulfillment Task. We can extend the existing task table to leverage
all of the elements and logic associated with the task table while being
able to add our own modifications without cluttering up the base table:
1. To do this, let's type tables in the Nav Bar filter and select the
Tables link under System Definition:
2. Once you have the Tables list view open, click the New button.
3. Once you have the New Record screen for a table, fill out the
required fields, remembering to select the Task table under
Extends table. You'll notice that a new application link and menu
will be created in the Nav Bar for us:
5. Under the Controls tab, select Auto-number. This will give the
table a sequence and unique prefix for these tasks for easy
reference. You'll also notice that a unique role will be created
specifically for this table. We will study more on this in a later
chapter.
6. Once you've finished filling out the form, click Submit:
7. After you click on Submit, the system will take a short time to
create the table and other elements. Once it's complete, you should
find our new application name in the Nav Bar using a simple filter.
Records
Well, we've got a table. Now what? Let's create a record to test with:
3. Now that Abel has some work, let's open the record to see what he
sees:
You will use the sys_id of records frequently when using web
services or when scripting within the environment.
ACLs
Let's take a look at data layer level security on tables. The following
shows how we can learn more about the tables that we'll be working with
in the future:
While you can view ACLs in this view, you will need to
elevate your admin role to security_admin to make any
changes. You can accomplish this by selecting Elevate Roles
under your Profile menu.
3. Let's look at the read record associated with our custom table role:
ACLs control the basic create, read, update, and delete (CRUD)
database operations. Normally, you won't be controlling things this
granularly, but it's useful to understand the security layer of the
data in case you're stumped on granting or restricting access.
1. Navigate to the Workflow Editor through the Nav Bar. When you
click the link, it will open in its own window. The Workflow
Editor is an interface for creating and modifying workflows by
arranging and connecting activities to drive processes. You can
manage multiple workflows on the same screen, create custom
workflow activities, and use existing activities as data sources.
Users with the workflow_creator role can create workflows. Users
with the workflow_admin role can create, modify, delete, and
publish workflows.
2. For now, let's create a basic workflow for a fulfillment. Click on
the + button in the upper-right corner.
This will open the New Activity: Create Task form. We will want
to name the activity and give it some parameters for creation. Once
you've added them, click Submit:
6. Follow the same process to create the Complete Requirements
task:
7. Once you've added the tasks, highlight and delete the flow arrow
between the Being and End steps, then drag and connect each of
the new steps as follows: Begin | Gather Requirements
Task | Complete Requirements Task | End:
It looks like we have a completed wireframe for the fulfillment
workflow, but I'd like to add a couple more activities. Notably, this
will be keeping the Fulfillment State field current with the actual
tasks that are being completed.
8. We'll do this using the Set Values activity under Utilities. Drag
two of them to the flowchart space with the following parameters:
9. Now, let's wire up our new activities with some flow arrows:
10. And then we can Publish our new workflow using the context
menu.
11. As the effects of workflows are not retroactive, to see the effects
of our workflow, we will need to create a new Fulfillment record.
Let's do that next:
12. Well, we can see the Fulfillment record, but what about the tasks
that are created and managed by the workflow? For that, we'll
need to add a Related List using the context menu.
13. The Related List we want to add in this case is the Task | Parent
list. Add it using the slush-bucket. Then click Save:
14. That's much better! We'll cover more on Related Lists and other
UI elements in Chapter 2, Performing Core Configuration and
Management Tasks.
One more thing to remember is that you can have more than one workflow
apply to the same piece of work product. In this way, you can keep
responsibilities separated between smaller workflows. You may find this
approach easier to manage over time.
REST API Explorer
One more interesting tool I want to touch on is the REST API Explorer.
This tool is a useful interface for getting your feet wet with making REST
calls into the ServiceNow system, and probably the first thing you should
use to prototype new integrations into your system:
1. To find this tool, look under System Web Services | REST | REST
API Explorer. Using this tool, you can perform all the normal
CRUD operations on the DB layer, provided you have the
requisite permissions.
2. sysparm_query:
sys_id=b778b2434f5a0300bbf9b7a18110c783 (Use the
sys_id you copied from the record in the previous record
creation recipe)
3. If your REST query is valid, you'll receive a response that
includes the HTTP code, header information, and the response
body. Here's the sample from my test:
Response Body:
{
"result": [
{
"parent": "",
"made_sla": "true",
"watch_list": "",
"upon_reject": "cancel",
"sys_updated_on": "2017-11-12 19:43:16",
"approval_history": "",
"number": "FUL0001002",
"sys_updated_by": "admin",
"opened_by": {
"link": "https://dev41882.service-
now.com/api/now/table/sys_user/6816f79cc0a8016401c5a33be04be441",
"value": "6816f79cc0a8016401c5a33be04be441"
},
"user_input": "",
"sys_created_on": "2017-11-12 19:43:16",
"sys_domain": {
"link": "https://dev41882.service-
now.com/api/now/table/sys_user_group/global",
"value": "global"
},
"state": "1",
"sys_created_by": "admin",
"knowledge": "false",
"order": "",
"closed_at": "",
"cmdb_ci": "",
"delivery_plan": "",
"impact": "3",
"active": "true",
"work_notes_list": "",
"business_service": "",
"priority": "4",
"sys_domain_path": "/",
"time_worked": "",
"expected_start": "",
"opened_at": "2017-11-12 19:42:58",
"business_duration": "",
"group_list": "",
"work_end": "",
"approval_set": "",
"work_notes": "",
"short_description": "Test Fulfillment",
"correlation_display": "",
"delivery_task": "",
"work_start": "",
"assignment_group": "",
"additional_assignee_list": "",
"description": "Fulfill this Request",
"calendar_duration": "",
"close_notes": "",
"sys_class_name": "u_fulfillment",
"closed_by": "",
"follow_up": "",
"sys_id": "b778b2434f5a0300bbf9b7a18110c783",
"contact_type": "",
"urgency": "3",
"company": "",
"reassignment_count": "0",
"activity_due": "",
"assigned_to": {
"link": "https://dev41882.service-
now.com/api/now/table/sys_user/62826bf03710200044e0bfc8bcbe5df1",
"value": "62826bf03710200044e0bfc8bcbe5df1"
},
"comments": "",
"approval": "not requested",
"sla_due": "",
"comments_and_work_notes": "",
"due_date": "",
"sys_mod_count": "0",
"sys_tags": "",
"escalation": "0",
"upon_approval": "proceed",
"correlation_id": "",
"location": ""
}
]
}
4. You might have also noticed that the REST API Explorer provides
code samples to execute these same calls outside of the
ServiceNow environment. Click on any of these hyperlinks to pull
up a dialog box with the sample code.
5. Here is the JavaScript code you might use to make this same call
from a third-party environment:
client.setRequestHeader('Accept','application/json');
client.setRequestHeader('Content-Type','application/json');
client.onreadystatechange = function() {
if(this.readyState == this.DONE) {
document.getElementById("response").innerHTML=this.status +
this.response;
}
};
client.send(requestBody);
See also
Tables: https://docs.servicenow.com/bundle/jakarta-servicenow-platform/pa
ge/administer/table-administration/task/t_CreateATable.html
ACLs: https://docs.servicenow.com/bundle/jakarta-servicenow-platform/pag
e/administer/contextual-security/concept/access-control-rules.html
Request Management
Incident Management
Change Management
Problem Management
Knowledge Management
Service Portal.
Incident Management
ITIL defines an incident as, An unplanned interruption to an IT Service or
a reduction in the quality of an IT Service. Essentially, an incident is a task
that's logged when something's broken. A workstation could be failing or a
website could be down. No matter the root cause, the goal of Incident
Management is to restore the failing node to service as soon as possible.
This can come through a repair or through a workaround. Have you tried
turning it on an off again? This is a valid and common attempt at Incident
Management.
You may need to click Update or Save. Afterwards, the Incident will be
resolved.
Change Management
ITIL defines a change as, The addition, modification or removal of
anything that could have an effect on IT Services. Change Management
can be a blessing or a bane, depending on how it's implemented and
viewed within an IT Organization. The basic idea of Change Management
is to be transparent about what's being modified within your infrastructure
and when.
1. Open any incident from the Incident list screen and right-click the
context menu in the header bar. Click Create Problem:
2. This action creates the entire problem record without further user
intervention. From here, the problem can be assigned to a group
for attention, depending on your organization's processes:
3. One additional advantage to logging the problem through the
Incident context menu is that it automatically creates a
relationship back to the incident for easy reference. Additional
relationships to incidents or other work products can be created to
ensure that complete information is available to the problem
management personnel:
Knowledge Management
There's a running joke in application development which goes, Everyone
wants documentation. They just don't want you to spend any time on
it. This is no different in IT Service Management. Knowledge
Management and other documentation almost become afterthoughts in
favor of building new functions or running to put out the next fire. In truth,
Knowledge Management is a key value-add to any IT organization and is
vital for initiatives like Knowledge Centered Support and Case Deflection.
Do not neglect your Knowledge Management process!
Look at that! Now that we've captured knowledge from previous incidents,
our Service Desk has the proper information available to address customer
issues without forwarding an incident to another group. Definitely, keep
Knowledge Management in mind throughout your ITSM and other
ServiceNow implementations.
See also
Request: https://docs.servicenow.com/bundle/jakarta-it-service-managemen
t/page/product/planning-and-policy/concept/c_RequestManagement.html
Incident: https://docs.servicenow.com/bundle/jakarta-it-service-managemen
t/page/product/incident-management/concept/c_IncidentManagement.html
Change: https://docs.servicenow.com/bundle/jakarta-it-service-managemen
t/page/product/change-management/concept/c_ITILChangeManagement.html
Problem: https://docs.servicenow.com/bundle/jakarta-it-service-manageme
nt/page/product/problem-management/concept/c_ProblemManagement.html
Knowledge: https://docs.servicenow.com/bundle/jakarta-servicenow-platf
orm/page/product/knowledge-management/topic/p_KnowledgeManagment.html
Managing your profile in
ServiceNow
One more item to close out our chapter involves managing your profile in
ServiceNow. While it would be nice to depend on automation and other
tool driven options to determine our experience, it is important for users to
understand what they can control around their user record.
How to do it...
In this section, we will cover some basics around controlling your own
experience within ServiceNow.
User profile
1. To access your profile in ServiceNow, use the Profile context
menu in the upper-right corner.
2. On your profile screen, you can modify some basic localization
items, like how you'd like to see Date/Time fields or what your
Time zone is. You can also add a profile photo or select a
Language for localization.
Notifications
One important part of the user experience is controlling when and how
you'll receive notifications from ServiceNow. There are literally hundreds
of out-of-the-box emails notifications for the various modules, and users
can feel overwhelmed by the sheer volume of email or texts coming out of
the system:
Impersonation: https://docs.servicenow.com/bundle/jakarta-platform-adm
inistration/page/administer/users-and-groups/concept/c_ImpersonateAUser.ht
ml
Performing Core Configuration
and Management Tasks
In this chapter, we will cover the following recipes:
3. This will open up a file selection dialog where you can select your
new logo. Click Open to accept:
4. Then click Save to apply your changes. Once you click your home
page icon, the image should refresh.
5. If you'd like to go a little further and apply a theme to ServiceNow
that matches your company's branding, navigate to System
Properties | Basic Configuration U16.
6. If you're knowledgeable about Cascading Style Sheets (CSS),
you're more than welcome to design your style elements, or you
can use the following code:
3. From the Form Layout slush bucket, you'll have several options to
modify the form, as shown in the bullet list given here:
2. Type: Integer
This will add the field to the selected section. You can then
click Save.
6. Once you click Close, you will be able to find your new field in
the section from the field creation:
This will take you to the list view of UI Policies that apply to an
Incident. You'll then Click New.
3. Let's say that our customer wants the resolution notes and
resolution code to be required when an Incident is resolved. We
can implement this by filling out the UI policy as follows:
4. Order: 100
10. Now that we've completed our UI Policy, let's navigate back
to Incident | Create New to test it out.
11. Within the new Incident form, set the State to Resolved. The fields
subject to the UI Policy should now show as mandatory (red
asterisk when empty):
See also
UI Policies: https://docs.servicenow.com/bundle/jakarta-platform-administration/pa
ge/administer/form-administration/task/t_CreateAUIPolicy.html
Configuring UI actions on
forms
A UI Action is a form button used to map scripted actions from relevant
forms. Examples of this are create problem or create change.
Getting ready
To use this recipe, you should have an active ServiceNow instance
(Jakarta), valid credentials, and an admin role. If you've provisioned a
personal development instance during Chapter 1, Getting Started with
ServiceNow, that will be sufficient.
How to do it...
Open any standard web browser. As you can tell from the screencaps, my
favorite is Chrome and follow these steps
3. This will bring up a list view of all UI actions defined for the
Incident form. Let's define a new one by clicking New.
4. Let's define our new UI Action as follows:
4. Active: Checked
This will define who is able to see and use the UI Action button.
Because customers are able to view the status of Incidents, we
don't want them to inadvertently try to assign the Incident to
themselves.
action.setRedirectURL(current);
current.assigned_to = gs.getUserID();
current.setForceUpdate(true);
current.update();
7. This script will get information about the user currently viewing
the incident. Update the Assigned To value to their user ID. Once
you've finished pasting in the code, click on Submit.
2. Let's find the Data Archiving plugin and activate it. Type data into
the Name field and click Enter to search. Data Archiving should
be at the top of the list. Click it to continue.
3. Within the Data Archiving record screen, click the Related Link
| Activate/Upgrade to begin activation of this plugin.
4. Let's take a look at the Schema map for the Incident table. With
Incident still highlighted under Table Name, click Schema map:
The schema map is a helpful interface that will show you visually
which tables directly reference your selected table. This can help
you to plan your data model and the business logic that you build
over it:
This is only an overview of the potential of the database layer. While it's
simplified and abstracted more so than a conventional database interface,
you can accomplish most first pass optimizations and other DB tasks here.
See also
Schema maps: https://docs.servicenow.com/bundle/jakarta-platform-administratio
n/page/administer/table-administration/task/t_GenerateASchemaMap.html
Getting into the CMDB
CMDB stands for Configuration Management Database. It's intended to
be a representation of not only your physical and logical IT environment,
but also an abstraction of all of the business services and capabilities of
your organization. As organizations scale, keeping track of your entire
environment becomes an unmanageable task for individuals alone.
Additionally, automating and integrating information about your
environment is vital for driving automation such as software deployments,
asset lifecycle management, and vulnerability detection, to name but a
few.
Getting ready
To use this recipe, you should have an active ServiceNow instance
(Jakarta), valid credentials, and an admin role. If you've provisioned a
personal development instance during Chapter 1, Getting Started with
ServiceNow, that will be sufficient.
How to do it...
Open any standard web browser. As you can tell from the screencaps, my
favorite is Chrome and follow these steps
CI Class Manager.
2. Name: u_flux_diode
3. Extends table: Hardware
7. Our new Flux Diode table has been created. And, since we added
a module for this class, it's also available in the Nav Bar:
There's more...
For those with an object-oriented programming background, this system of
inheritance from base objects/models may seem familiar. For
example: Computer is a Hardware is a Configuration Item. What's
important to recognize is that these classifications can be used to drive
behaviors and events in the system that are relevant to your organization.
See also
CMDB: https://docs.servicenow.com/bundle/jakarta-servicenow-platform/page/produ
ct/configuration-management/concept/cnfig-mgmt-and-cmdb.html
Understanding the system
dictionary
The system dictionary is a master table that contains details for each table
and definitions for every column/field on each throughout your instance.
Getting ready
To use this recipe, you should have an active ServiceNow instance
(Jakarta), valid credentials, and an admin role. If you've provisioned a
personal development instance during Chapter 1, Getting Started with
ServiceNow, that will be sufficient.
How to do it...
Open any standard web browser. As you can tell from the screencaps, my
favorite is Chrome and follow these steps:
Definition | Dictionary.
2. This will bring up the list view of all dictionary entries. Let's
experiment a bit by creating a new entry. Click New.
3. Fill out the form as follows and then click Submit:
1. Table: Incident[incident]
2. Type: String
2. Type: SLA
3. Table: Incident[incident]
5. Duration: 4 Hours
As you can see, we have an On Hold state, which should pause our
SLA. Under Pause condition, enter the following:
Finally, we'll need to let the SLA know when it should stop
running entirely. Under Stop condition, enter the following:
Once you've completed this, click Submit. All incidents that fit these
conditions will now have the defined SLA attached:
See also
SLAs: https://docs.servicenow.com/bundle/jakarta-customer-service-management/page
/product/customer-service-management/concept/c_ServiceLevelAgreements.html
Setting up system rules
Out of the box, ServiceNow provides data lookup and assignment rules to
automatically assign a task to users or groups.
Getting ready
To use this recipe, you should have an active ServiceNow instance
(Jakarta), valid credentials, and an admin role. If you've provisioned a
personal development instance during Chapter 1, Getting Started with
ServiceNow, that will be sufficient.
How to do it...
Open any standard web browser. As you can tell from the screencaps, my
favorite is Chrome and follow these steps:
1. Category: Software
2. State: In Progress
6. Inside the System Settings dialog, click Show update set picker
in header in the Developer tab and then close the dialog:
This will show the update set picker next to your username. The
currently selected update set will display.
8. Your record will show as complete, and your assigned update set
will revert to default in the update set picker. Next, click
on Related Link | Export to XML.
9. This will open up a file explorer dialog where you can choose a
name and location for your XML file. Now click on Save:
10. Now, we're only working with one instance here. But let's pretend
that we're importing the same update set to our existing instance.
Import your newly saved XML file by navigating to System
Update Sets | Retrieved Update Sets.
11. Click on Related Links | Import Update Set from XML.
12. Once on the import XML screen, click Choose File to open up
another filesystem dialog where you can find your previously
saved XML. Once you've selected your file, click Upload to
retrieve your update set to the instance.
13. Open the newly retrieved update set by clicking its name on the
list view. You'll see that the State is Loaded. This means the
update set is staged in ServiceNow, but not yet committed to the
codebase. The update set must first be previewed and then
committed.
14. Click the button Preview Update Set:
15. A short process dialog will run, which evaluates the code being
imported and indicates any collisions or conflicts. Blue bars are
good! Should you run into any collisions or conflicts, the import
process will display a related list log indicating which parts of the
import require attention.
16. Now the State is Previewed. We're ready to commit. Click
the Commit Update Set button:
Another process dialog will run. Again, blue bars are good!
Keeping track of your update sets can be tricky and confusing at
first, but you'll soon get the hang of it!
There's more...
It is important to note that data isn't captured by default in update sets.
This includes information such as individual users or groups, or ticket
data. It's possible to force this data through, but it must be done manually
from the list view of the table containing the data.
See also
Update sets: https://docs.servicenow.com/bundle/jakarta-application-development/p
age/build/system-update-sets/concept/system-update-sets.html
Building and Designing Data-
Driven Applications
In this chapter, we will cover the following recipes:
2. This will open a pop-up tab to the Application Studio. Since this is
our first time here, it will ask us where we'd like to begin.
Click Create Application:
3. This will bring up the Create Application wizard. Since most apps
consist of a table with entries, we'll let ServiceNow do the heavy
lifting. Next to Create custom application click Create:
4. This will bring up the Create Application form. Let's name our
new app—SNow Cookbook Chapter 3. The remaining fields will auto-
populate:
5. Next, click the Create Table toggle:
9. Click Back to list to see your newly created app inside the Studio
interface:
10. On the Load Application screen, click the SNow Cookbook
Chapter 3 link for our new app:
11. The Studio interface organizes all of the application objects we've
created into categories such as Data Model | Table, Access
Control | Roles and Access Controls, and Navigation |
Menus and Modules:
12. If you navigate back to your main instance, you can see our new
app is already available on the Nav Bar. This lays the foundation
for the recipes in the rest of this chapter:
See also
Creating applications: https://docs.servicenow.com/bundle/jakarta-application-d
evelopment/page/build/applications/concept/c_CreatingApplications.html
Adding new components to
your application
Within the ServiceNow Application Studio, you're able to keep all of the
components associated with your application scope without the benefit of
an Update Set or otherwise manually managing your code. For this recipe,
we will practice adding a new component to our app.
Getting ready
To use this recipe, you should have an active ServiceNow instance
(Jakarta), valid credentials, an admin role, and an application already
created in Studio. If you've provisioned an app in the first recipe of this
chapter, that will be sufficient.
How to do it...
Open any standard web browser. As you can tell from the screencaps, my
favorite is Chrome and follow these steps:
4. This will bring up the new Module form. Let's populate the
following values:
6. Then click Submit. The Studio interface should show our new
item:
7. If you go back to the main ServiceNow interface, you'll see our
new module already available for use:
See also
Creating application files: https://docs.servicenow.com/bundle/jakarta-applicati
on-development/page/build/applications/task/t_AddAnAppFileToAnApp.html
Publishing a new application
Before we get too far into fleshing out our new application, we might want
to take some time to think about how we might make it available to other
ServiceNow environments and the organizations that use them. For this
recipe, we're going to publish our application to GitHub.
Getting ready
To use this recipe, you should have an active ServiceNow instance
(Jakarta), valid credentials, an admin role, and an application already
created in Studio. If you've provisioned an app in the first recipe of this
chapter, that will be sufficient. Additionally, you will need a GitHub
account with rights to write to an existing repository. (It's free!)
How to do it...
Open any standard web browser. As you can tell from the screencaps, my
favorite is Chrome and follow these steps:
A process dialog will run with a success message. Blue bars are
good!
Now, you will be able to commit and preserve your history within
the Source Control feature of Studio:
There's more...
GitHub isn't your only option for source control and sharing your
applications, another popular option is to utilize the ServiceNow store to
either share or market your app to potential customers.
3. This will open up the Remote Instance form. Populate the values
as follows:
6. Active: Checked
With the relationship between the two instances created, you are
now able to push updates from one instance to another. Changes
made in either environment will be automatically detected by Team
Development for easy reconciliation:
See also
Team Development: https://docs.servicenow.com/bundle/jakarta-application-deve
lopment/page/build/team-development/concept/c_TeamDevelopment.html
Getting into client scripting
Client scripts are JavaScript code that are interpreted by the user's web
browser. Client scripts can be used to put validation on a ServiceNow
form and for customization of ServiceNow behavior, such as making any
field read-only, mandatory, or hidden. While client scripts are very
powerful and versatile, they should be considered a last resort as they add
latency to the form loads and operations. Additionally, client-side
JavaScript can be overridden, halted or otherwise manipulated on the
client.
Getting ready
To use this recipe, you should have an active ServiceNow instance
(Jakarta), valid credentials, an admin role and an application already
created in Studio. If you've provisioned an app in the first recipe of this
chapter, that will be sufficient.
How to do it...
Open any standard web browser. As you can tell from the screencaps, my
favorite is Chrome and follow these steps:
3. UI Type: All
4. Type: onLoad
function onLoad() {
g_form.setReadOnly('number',true);
}
g_form: https://docs.servicenow.com/bundle/jakarta-application-developme
nt/page/app-store/dev_portal/API_reference/GlideForm/concept/c_GlideFormAP
I.html
Getting into server scripting
While we've covered scripting and business logic on the client side, what's
going on on the server side? ServiceNow provides several ways to
implement business logic and shared services on the server itself. The
most common of these is the business rule. Business rules are event-based
activities that drive other actions based on the data being accessed or
changed. Business rules have an additional benefit of running not just
from form interfaces, but also whenever other events are triggered server
side, such as scheduled jobs or API calls.
Getting ready
To use this recipe, you should have an active ServiceNow instance
(Jakarta), valid credentials, an admin role, and an application already
created in Studio. If you've provisioned an app in the first recipe of this
chapter, that will be sufficient.
How to do it...
Open any standard web browser. As you can tell from the screencaps, my
favorite is Chrome and follow these steps:
2. Table: Any table in the app. I'm using the table created in
a previous recipe
3. Active: Checked
4. Advanced: Checked
So, wait a second. Do we have a Due Date field on our table? I
don't! Before we proceed further, please ensure you have a suitable
Date field on the table you're using.
1. Type: Date
3. Insert: Checked
4. Update: Checked
})(current, previous);
9. Then click Submit. Once you've saved your new Business Rule,
any record you create without your Due Date field populated will
add a value of that date plus seven days.
10. To test, create a new record without populating the field:
GlideDateTime: https://docs.servicenow.com/bundle/jakarta-application
-development/page/app-store/dev_portal/API_reference/glideDateTimeScoped/c
oncept/c_GlideDateTimeScoped.html#ariaid-title29
1. Name: Chapter3Lib
})(current, previous);
client.setRequestHeader('Accept','application/json');
client.setRequestHeader('Content-Type','application/json');
client.onreadystatechange = function() {
if(this.readyState == this.DONE) {
document.getElementById("response").innerHTML=this.status +
this.response;
}
};
client.send(requestBody);
See also
REST API Explorer: https://docs.servicenow.com/bundle/jakarta-application-dev
elopment/page/integrate/inbound-rest/concept/c_RESTAPIExplorer.html
Implementing automated
testing
Testing is much like documentation. Everyone wants it but nobody wants
to spend any time on it. Beginning with the Istanbul release, ServiceNow
has implemented an easy-to-use module for testing called the Automated
Test Framework. Let's take a look.
Getting ready
To use this recipe, you should have an active ServiceNow instance
(Jakarta), valid credentials, an admin role, and an application already
created in Studio. If you've provisioned an app in the first recipe of this
chapter, that will be sufficient.
How to do it...
Open any standard web browser. As you can tell from the screencaps, my
favorite is Chrome and follow these steps:
6. Now that we have our test created, it's time to make it do useful
things. Click Add Test Step in the Test Steps tab:
7. In order to check if the Number field is behaving the way we
want, we must first open the form. Navigate to Form | Open a
New Form then click Next:
8. In the Add Test Step screen, select the relevant Table from your
app in development. Then click on Submit:
9. Our first step will open up a new record form. Next, we'll add a
test step to test the read-only behavior of the field. Click Add Test
Step again in the Test Steps tab:
10. In the Add Test Step form, select Form | Field State
Validation then click Next:
11. In this Add Test Step form, we'll want to add the Number field to
the Read only section. Use the slush bucket in that section to
move the Number field over to Selected. Then click on Submit:
12. It's a bit minimalist, but now we have a working test. Let's
click Run Test to see it run:
13. Since this is a UI Test, ServiceNow needs a free browser window
to borrow for pulling up the form and testing. Click Run Test:
This will open up a test runner window and your tests will execute.
It will look something like the following screenshot:
And if you navigate back to your test entry, you'll see the results of
the test. Again, blue bars are good!
14. If you click Go to Result, you'll see a log of the test steps and
results. The framework will even keep screenshots of UI steps to
assist with troubleshooting or general use. This can be kept for a
set amount of time, or indefinitely if desired:
There's more...
This recipe should give you a small idea of what's possible in ATF. I
cannot understate the value of building tests as you go. They are simply
the closest thing you're going to have to a transcript of customer
requirements when you have a reported issue in your platform or introduce
a bug or other error during subsequent development. Don't neglect this
dimension of software development!
See also
Automated Test Framework: https://docs.servicenow.com/bundle/jakarta-servi
cenow-platform/page/administer/auto-test-framework/concept/atf-overview.html
Configuring Alerts and
Notifications
In this chapter, we will cover the following recipes:
Email troubleshooting
Configuring delegates
Introduction
Communication and proactive notifications are essential to any IT Service
Management application. Therefore, ServiceNow has a core function to
send or receive notifications. Generally, they are email based, but they can
also take the form of SMS messages or other push notifications to mobile
devices. Outbound notifications are generally based on events and
activities inside the environment. Inbound messages can be processed into
new work products, such as an incident or request, or an update to an
existing item.
Setting up email notifications
for users
Microsoft Exchange is widely used by many individuals and corporate
houses for email communication. This recipe will show you the basic
configuration to enable incoming or outgoing emails for ServiceNow.
Getting ready
To use this recipe, you should have an active ServiceNow instance
(Jakarta), valid credentials, and an admin role. If you've provisioned a
personal development instance during Chapter 1, Getting Started with
ServiceNow, that will be sufficient.
How to do it...
Open any standard web browser. As you can tell from screencaps, my
favorite to use is Chrome and follow these steps:
header:
2. Table: Incident[incident]
3. Active: Checked
1. Inserted: Checked
Description: ${description}
Notifications: https://docs.servicenow.com/bundle/jakarta-servicenow-pla
tform/page/administer/notification/reference/notifications.html
Working with email templates
An email template is a reusable component that may be used with more
than one notification to keep a consistent look and feel to similar
notifications.
Getting ready
To use this recipe, you should have an active ServiceNow instance
(Jakarta), valid credentials, and an admin role. If you've provisioned a
personal development instance during Chapter 1, Getting Started with
ServiceNow, that will be sufficient.
How to do it...
Open any standard web browser. As you can tell from screencaps, my
favorite to use is Chrome and follow these steps:
2. Table: Incident[incident]
Description: ${description}
3. Now that you've created a template, you can either create a new
notification or refactor an existing one by modifying the Email
template field in the notification. This saves a great deal of
manual curation of individual notifications in favor of using a
shared code base:
See also
Email templates: https://docs.servicenow.com/bundle/jakarta-servicenow-platform
/page/administer/notification/concept/c_EmailTemplates.html
Getting into notification scripts
Sometimes, you're going to need to retrieve related information that isn't
present or reachable from the fields on the current table. In cases like
these, the notifications module supports scripting to incorporate deeper or
more complex logic. Additionally, this is another way to incorporate
shared code into multiple notifications.
Getting ready
To use this recipe, you should have an active ServiceNow instance
(Jakarta), valid credentials, and an admin role. If you've provisioned a
personal development instance during Chapter 1, Getting Started with
ServiceNow, that will be sufficient.
How to do it...
Open any standard web browser. As you can tell from screencaps, my
favorite to use is Chrome and follow these steps:
3. In the new Email Script form, populate the following values, and
then click Submit:
1. Name: incident_assigned_assets
As you can see in the email logs, our new prefix is now the default for all
email watermarks.
See also
Email watermarking: https://docs.servicenow.com/bundle/jakarta-servicenow-pla
tform/page/administer/notification/concept/c_WorkingWithWatermarks.html
Email troubleshooting
During your day-to-day support tasks, you're certain to come across
reports of missing or excessive email traffic. Knowing how to configure
global properties and review the email logs are important pieces of
knowledge.
Getting ready
To use this recipe, you should have an active ServiceNow instance
(Jakarta), valid credentials, and an admin role. If you've provisioned a
personal development instance during Chapter 1, Getting Started with
ServiceNow, that will be sufficient.
How to do it...
Open any standard web browser. As you can tell from screencaps, my
favorite to use is Chrome and follow these steps:
This list view will keep a complete record of all inbound and outbound
email traffic for troubleshooting purposes. Please ensure you're using
appropriate business logic to keep the log form cleaned up and
manageable. Check out the email retention plugin if you'd rather not
manage the email archive manually.
See also
Email setup: https://docs.servicenow.com/bundle/jakarta-servicenow-plat
form/page/administer/reference-pages/concept/c_EmailConfiguration.html
5. You should be able to see the Delegates related list on the user
form. Click New to create a new delegate:
From this form, you can choose a new delegate, which notification traffic
they will receive, and when this should begin and end. I can't stress how
useful this simple step is for users and how many cycles it will save your
ServiceNow administrators. Teach this early and often!
See also
Service delegation: https://docs.servicenow.com/bundle/jakarta-servicenow-platfo
rm/page/use/employee-self-service/concept/c_ServiceDelegation.html
Building and Configuring
Reports
In this chapter, we will cover the following recipes:
Creating a dashboard
4. Let's change the visualization under Type in the report sidebar. I'm
a fan of donuts, but you're welcome to try any visualization you
like. Click Next once you've decided:
This will bring up your new visualization. The breadcrumb hasn't
changed, but the manner in which it displays has:
I'm not a design person, but I've learned from smarter people that the
impact of design and visualization to convey meaning to leadership cannot
be overstated. While it seems like a couple of simple toggles, reporting is
one of the core value-adds of the platform.
See also
View reports: https://docs.servicenow.com/bundle/jakarta-performance-analytics-a
nd-reporting/page/use/reporting/reference/r_ViewTheReportsList.html
Creating custom reports
By default, ServiceNow provides the View/Run module to view the
existing report or create a new report. In this recipe, you will learn how to
create new reports within the ServiceNow environment.
Getting ready
To use this recipe, you should have an active ServiceNow instance
(Jakarta), valid credentials, and an admin role. If you've provisioned a
personal development instance during Chapter 1, Getting Started with
ServiceNow, that will be sufficient.
How to do it...
Open any standard web browser. As you can tell from screencaps, my
favorite to use is Chrome and follow these steps:
3. Table: Incident[incident]
This will bring up the Type tab. If you completed the previous
recipe, you'll remember that this is where we choose a visual style
for our report. Let's do a pie chart this time. Click Next:
3. Right now, we're scanning the entire incident table to get our
results. We want to narrow this down a bit. Populate
the Configure tab with the following values:
4. With this report open, click on the down arrow next to the Save
button and select Export settings:
5. This will bring up a dialog where we can choose our newly
created template. Select it from the lookup field and click Close:
6. Next, select the Export to PDF option from the down-arrow menu.
Once the export is complete, it will be available for download:
You'll be prompted to save the PDF locally and open it. The header and
footer information you've selected in your template will be displayed in
the report data.
See also
Report templates: https://docs.servicenow.com/bundle/jakarta-performance-analyt
ics-and-reporting/page/use/reporting/concept/c_PDFPageHeaderFooterTemplates.html
How to schedule a report
So, we've covered the basics of how to build a report. What about making
the outputs available to a wider audience? It's foreseeable that your
leadership and other interested parties won't be day-to-day users of
ServiceNow, but they still need regular updates on what's going on in your
IT organization. Let's take a look at how that's done.
Getting ready
To use this recipe, you should have an active ServiceNow instance
(Jakarta), valid credentials, and an admin role. If you've provisioned a
personal development instance during Chapter 1, Getting Started with
ServiceNow, that will be sufficient.
How to do it...
Open any standard web browser. As you can tell from screencaps, my
favorite to use is Chrome and follow these steps:
1. Run: Weekly
2. Day: Monday
3. Time: 7:00:00
3. If you'd like to test your report output, open the newly created
report and click the Execute Now button. Your recipients should
receive the output through email. Remember to test!
See also
Schedule a report: https://docs.servicenow.com/bundle/jakarta-servicenow-platfor
m/page/administer/reference-pages/task/t_ScheduleAReport.html
Creating a dashboard
Sometimes an email attachment isn't sufficient for sharing and visualizing
report data. In this recipe, we will see how to create a dashboard.
Getting ready
To use this recipe, you should have an active ServiceNow instance
(Jakarta), valid credentials, and an admin role. If you've provisioned a
personal development instance during Chapter 1, Getting Started with
ServiceNow, that will be sufficient.
How to do it...
Open any standard web browser. As you can tell from screencaps, my
favorite to use is Chrome and follow these steps:
1. Title: You can choose anything you like. For this example,
I'll use Chapter 5 Dashboard.
3. Now that we have our new home page in place, we need to make
it available as a dashboard. Navigate to My Home and click
the Create dashboard version button.
5. Now that we have our dashboard created, let's add a report to it.
Click the + button in the upper-right and select Reports. For my
example, I'll be using the Incident Chapter 5 report we created in a
previous recipe:
6. Click the Add button.
7. Next, we'll want to ensure our new dashboard is shared with the
correct groups. Click the sharing button in the upper-right corner.
Then add the itil role to this dashboard:
You can repeat this process as needed to make reporting data available to
users directly in the Self-Service module.
See also
Administering dashboards: https://docs.servicenow.com/bundle/jakarta-perform
ance-analytics-and-reporting/page/use/dashboards/concept/c_DashboardAdministration.
html
Working with the database
view for reporting
ServiceNow provides system tables in which the data is stored and grants
you the ability to create custom tables as needed. However, it's foreseeable
that you'll receive requests for reporting that include results from multiple
tables. In this case, you'd define a database view to assist with this request.
In this recipe, you will learn to create a database view.
Getting ready
To use this recipe, you should have an active ServiceNow instance
(Jakarta), valid credentials, and an admin role. If you've provisioned a
personal development instance during Chapter 1, Getting Started with
ServiceNow, that will be sufficient.
How to do it...
Open any standard web browser. As you can tell from screencaps, my
favorite to use is Chrome and follow these steps:
4. Under View Tables, click the New button. Populate the following
values to include the Incident table and then click Submit:
1. Table: Incident[incident]
1. Table: Problem[problem]
6. Now, back at the Database View, click the Try It related link to see
the results of your view definition.
7. This will pull up a list view of all the rows returned by our join,
returning the first few columns alphabetically. You can refine the
column definition by right-clicking any column header and
clicking Configure | List Layout. The column slush-bucket will
have the prefixes we've defined in the view. Include the Number
field from each table to help the layout make more sense:
8. Click Save when you're done defining the view. This should bring
up your list view with a more user-friendly definition of the
incidents and problems being returned:
You can refine and further qualify your view definition and the results list
as needed. This is very useful for providing just enough information to
users and integration providers, rather than forcing them to sort things out
from the base database schema.
See also
Database views: https://docs.servicenow.com/bundle/jakarta-performance-analytic
s-and-reporting/page/use/reporting/task/t_CreateADatabaseView.html
Creating and Configuring
Workflow Activities
In this chapter, we will be covering the following recipes:
Adding notifications
This will bring up the New Workflow dialog where we can choose
which table the workflow maps to and when it should bind to a
task on that table.
5. Under the Conditions tab, we'll decide when the workflow should
trigger. Populate the following and then click Submit:
3. If your workflow is not checked out, use the hamburger icon in the
upper-left corner to check it out:
Just for demonstration purposes, we're going to add an Approval
step for Abel Tuter to kick off our workflow. We will want the
workflow to continue if he approves and end if he rejects.
4. From the Core tab on the right sidebar, click and drag
the Approval – User activity onto your canvas. It can be found
under Core Activities | Approvals:
This will bring up the Workflow Activity interface.
Under Approvers – Users, click the lock icon to open the user
lookup and find Abel Tuter and click Submit. This will bring our
approval activity on the canvas:
7. Then, let's connect the Rejected outcome to the End activity. This
will halt the workflow entirely if the approver responds with a
rejection:
For now, we won't add anything in the case of approved. But now,
the approval request will be sent with items mapped to our
workflow and will end immediately, if the approval is rejected.
See also
Approval actions: https://docs.servicenow.com/bundle/jakarta-servicenow-platfor
m/page/administer/workflow-activities/reference/r_ApprovalAction.html
Adding a task activity
One very common workflow modification will be to add a task. In this
recipe, we'll be covering the basics.
Getting ready
To use this recipe, you should have an active ServiceNow instance
(Jakarta), valid credentials, and an admin role. If you've provisioned a
personal development instance during Chapter 1, Getting Started with
ServiceNow, that will be sufficient.
How to do it...
Open any standard web browser. As you can tell from the screencaps, my
favorite is Chrome and follow these steps:
3. If your workflow is not checked out, use the hamburger icon in the
upper-left corner to check it out:
In the previous recipe, we added an Approval step to our workflow
and instructed the workflow to end if the approval is rejected. But
what about if it's approved? In this case, we're going to assign a
task for a review of our incident.
This is a very minimalist example of a task activity in a workflow. You
can launch parallel task flows and require that they all be completed
before ending the workflow, each of which with multiple approval steps
and other activities. Please do be mindful of naming your tasks
meaningfully and closing out each individual thread you create.
See also
Workflow tasks: https://docs.servicenow.com/bundle/jakarta-servicenow-platform/
page/administer/workflow-activities/reference/r_CreateTask.html
Adding notifications
In Chapter 4, Configuring Alerts and Notifications, we covered alerts and
notifications. Within workflows, you can also create ad hoc notifications
or trigger existing notifications from those configured on your platform. In
this recipe, we'll cover how to create an ad hoc notification.
Getting ready
To use this recipe, you should have an active ServiceNow instance
(Jakarta), valid credentials, and an admin role. If you've provisioned a
personal development instance during Chapter 1, Getting Started with
ServiceNow, that will be sufficient.
How to do it...
Open any standard web browser. As you can tell from the screencaps, my
favorite is Chrome and follow these steps:
3. If your workflow is not checked out, use the hamburger icon in the
upper-left corner to check it out:
3. If your workflow is not checked out, use the hamburger icon in the
upper-left corner to check it out:
4. For use in this example, I'm going to replace the Review Task step
with its own subprocess. To do this, I'll need to create a new
workflow with the following values:
I'm not actually putting in the Create Task step for this
example. However, you can have your subflow include as
many steps or processes as you wish. Once it is complete, the
parent workflow will resume.
5. Now, to bring in our subflow, I'm going to click and drag it into
the canvas for our parent workflow:
This will bring up the New Activity dialog. You can just
click Submit to accept the default values.
2. Select your workflow from the Workflows tab on the right sidebar.
This should bring it up on the drawing canvas:
3. If your workflow is not checked out, use the hamburger icon in the
upper-left corner to check it out:
4. Leadership has decided that we're going to wait 24 hours before
launching a review of Priority 1 incidents. To add a Timer, click
and drag the activity in the right sidebar under Timers |
Timer. This will bring up the New Activity dialog.
5. Let's populate it with the following values and click Submit:
3. Duration: Days 1
2. Select your workflow from the Workflows tab on the right sidebar.
This should bring it up on the drawing canvas:
3. If your workflow is not checked out, use the hamburger icon in the
upper-left corner to check it out:
Now, there will be a record in the parent incident that this workflow
completed the review subflow. This process could be further refined with
some business rules on the Incident table to check for the review
completion or by annotating the parent incident with the review task
number.
See also
Workflow utilities: https://docs.servicenow.com/bundle/jakarta-servicenow-platfo
rm/page/administer/workflow-activities/concept/c_UtilityActivities.html
Auditing and Diagnosing
ServiceNow
In this chapter, we will be covering the following recipes:
Session debugging
Background scripts
Introduction
As your implementation of ServiceNow grows, it's inevitable that you'll
face the need not only to get accurate queries on existing data, but also a
view of the change history of individual records. Based on the outcome of
these reviews, you might discover bugs or other unanticipated behavior.
The good news is that ServiceNow supports several approaches to
addressing this, such as integrated logging, debugging, and auditing. In
this chapter, we'll be looking at those.
Understanding auditing in
ServiceNow
ServiceNow has a dedicated audit table (sys_audit), which stores inserts
and changes of records. You can access the change history of records from
most form views.
Getting ready
To use this recipe, you should have an active ServiceNow instance
(Jakarta), valid credentials, and an admin role. If you've provisioned a
personal development instance during Chapter 1, Getting Started with
ServiceNow, that will be sufficient.
How to do it...
Open any standard web browser. As you can tell from the screencaps, my
favorite is Chrome and follow these steps:
3. Going forward, entries for this table will have an audit history that
can be accessed through the History | List option in the context
menu.
There's more...
Audited tables receive a huge amount of activity and data which can
introduce overhead and performance issues. This is something to take into
consideration when you choose to make a table auditable. Additionally,
the sys_audit table is intended for historical information purposes and can
be kept indefinitely. At some point though, the data on the sys_audit table
will become too cumbersome for day-to-day checks and queries. Out of
the box, ServiceNow has a scheduled job called Table Cleaner, which can
be used in case your table size gets out of hand.
See also
The sys_audit table: https://docs.servicenow.com/bundle/jakarta-platform-admini
stration/page/administer/security/concept/c_UnderstandingTheSysAuditTable.html
Understanding ServiceNow
upgrades
As a platform, ServiceNow has a goal to release two major platform
upgrades a year. These are the named releases (Istanbul, Jakarta, and
others), which are considered major releases that significantly change the
existing platform. There are also periodic patch releases that occur, as
needed. As such, it's likely that your ServiceNow implementation will be
frequently refreshed to address bugs and to implement new features.
Getting ready
To use this recipe in Production instances, you should have special access
to the ServiceNow HI Portal – https://hi.service-now.com. This is where
customers can raise support-related issues or request upgrades or plugins
to be deployed by ServiceNow Support.
For the purposes of this demo, we will step through the upgrade process to
the newly released Kingston version through our My Instance link at https:
//developer.servicenow.com.
How to do it...
Open any standard web browser. As you can tell from the screencaps, my
favorite is Chrome and follow these steps:
If you're feeling brave, click Yes.
3. The upgrade process will take a short while. While it's underway,
you'll have the following message on your My Instance console:
You can monitor the console or watch your email to determine
when the upgrade is complete.
There's more...
As mentioned previously, when you're managing paid instances, you'll
request patches and major releases from the ServiceNow HI Portal. It's
important to note that all processes of this type should be preceded by a
review of the release notes and followed by regression testing of your
newly upgraded instance.
See also
Upgrade your instance: https://docs.servicenow.com/bundle/jakarta-release-note
s/page/release-notes/upgrades/concept/upgrades-overview.html#upgrades-overview
Working with system logs
Out of the box, ServiceNow provides several options for logging. There
are general out-of-the-box logs for errors and warnings, as well as more
granular logs such as transactions.
Getting ready
To use this recipe, you should have an active ServiceNow instance
(Jakarta or Kingston), valid credentials, and an admin role. If you've
provisioned a personal development instance during Chapter 1, Getting
Started with ServiceNow, that will be sufficient.
How to do it...
Open any standard web browser. As you can tell from the screencaps, my
favorite is Chrome and follow these steps:
2. Here's some sample code that leverages the GlideSystem library:
3. Once you've entered your script, click the Run Script button. You
should see an output similar to the following:
lideSystemAPI.html
d.html
Service Portal
In this chapter, we will be covering the following recipes:
Configuring a portal
Portal branding
Portal pages
Portal widgets
2. We've seen a portal that's available out of the box, but what about
creating our own? From your instance, navigate to Service Portal |
Service Portal Configuration, which will bring up the Service
Portal module administration page. From here, click on the New
Portal option:
3. From the New Service Portal form, let's populate the following
values and click on the Save button:
3. Homepage: index
original Service Portal, but will have our new portal's title:
It's just that easy to spawn a new portal for your users.
Then click Save to fully enable the setting. Once this is enabled,
you can edit individual Pages and Widgets to grant or deny access
to individual components of the portal. For example,
the index page of our new portal now have a Can View and Cannot
View related list, each of which can be modified as needed to
control access to sections of each portal:
Now that we have a new portal in place, we will either continue to
reuse the existing shared components or build new ones to
implement unique features on our new portal. Throughout the
remaining recipes in this chapter, we'll be doing a bit of both!
See also
Service Portal Configuration: https://docs.servicenow.com/bundle/kingston-ser
vicenow-platform/page/build/service-portal/concept/service-portal-configuration-pag
e.html
Why mobile matters
One of the major purposes of implementing the Service Portal module was
creating a better experience for mobile users. As such, all of the content
that you develop for your portals should be built with mobile in mind.
Testing from multiple platforms and form factors is a base expectation
when using the Service Portal. Additionally, refactoring existing content
so that it will render and behave as expected on mobile devices is required.
Where this is going to impact new adopters of Service Portal, the most are
their catalogs, especially with the affected client scripts. In this recipe,
we'll walk through a refactoring example.
Getting ready
To use this recipe, you should have an active ServiceNow instance
(Jakarta or Kingston), valid credentials, and admin role. If you've
provisioned a personal development instance in Chapter 1, Getting Started
with ServiceNow, that will be sufficient.
How to do it...
Open any standard web browser. As you can tell from screencaps, my
favorite to use is Chrome and follow these steps:
2. From the list view, find the script named Set Source, which is
related to the Database Restore Technical Catalog item.
3. The intent of this catalog script is to dynamically set the source
restore variable based on which database the user selects for
restore. This has worked so far for users in the native interface.
However, since the UI Type for the script is set for Desktop, it will
not load or run in the Service Portal. In order to make this work,
we will want to set the UI Type to All:
4. Once you've made this selection, click on Update.
5. After you've saved the client script, now it's time to test it out in
the Service Portal. Navigate to https://{instancename}.service-
now.com/c8sp, which is the portal created in the beginning of this
chapter.
6. In the How can we help? type-ahead search, type database, which
should bring up Database Restore as one of the options:
7. Select it to bring up the catalog item. Once it's loaded, choose any
of the options from the Database to restore field. The Restore from
this source field should populate automatically:
Although tedious, this refactoring process will be necessary to
bringing your existing catalog content up to date so that it can be
accessed in the Service Portal. Trust me, it's well worth the
investment!
See also
Service Portal and Client Scripts: https://docs.servicenow.com/bundle/istanbul
-servicenow-platform/page/build/service-portal/concept/unsupported_client_scripts.h
tml
Branding and themes
We've seen how easy it is to stand up a Service Portal, but what about
making it your own? That's where branding and themes come in. Let's
walk through customizing our new portal.
Getting ready
To use this recipe, you should have an active ServiceNow instance
(Jakarta or Kingston), valid credentials, and admin role. If you've
provisioned a personal development instance in Chapter 1, Getting Started
with ServiceNow, that will be sufficient. In addition, to get the most out of
this section, you'll want to have gone through the first recipe in this
chapter, Configuring a portal, to have the portal settings and components
available that are referenced in the steps.
How to do it...
Open any standard web browser. As you can tell from screencaps, my
favorite to use is Chrome and follow these steps:
the search box, navigate to Service Portal | Themes. From the list
view, open the Stock theme. This is the theme that is currently
referenced in our custom portal.
2. When doing custom development within ServiceNow, it's wise to
fork existing content rather than overwrite it. In this way, you're
preserving the original content for reference and in case you might
need to rollback easily. To do this, we're going to type in a new
name for the theme and then right-click the gray header bar to
select Insert and Stay:
After making your selection, you will have a fresh copy of the
theme to make modifications to.
3. Next, we'll navigate to Service Portal | Portals and find
our Chapter 8 Service Portal so that we can change the Theme to
our new copy. From the portal view, change the Theme value
to Chapter 8. After you've updated the value, click on Update:
4. Next, we're going to update the colors for our new theme.
Navigate to Service Portal | Service Portal Configuration. When
the selection page appears, choose the Branding Editor option:
This will bring up the Branding Editor interface. Your settings will
be in the left sidebar, and your changes will preview in the window
on the right. Let's start with the Quick Setup tab.
5. The first option is the Portal title. We're going to leave that as is
for now. Next, we have an option to upload an image. Let's upload
the same image we're using in the ServiceNow native interface.
6. Click on Upload an image. Then, choose an appropriate file for
upload. The preview will update accordingly:
7. Next, we'll move on to the Theme Colors tab. This will give us
some CSS fields with which we can alter the colors used in the
new portal. I'm going to borrow some of the values we used when
updating the theme for the native platform.
8. Feel free to use whichever values you like, just to tinker. Here are
the values I changed:
the search box, navigate to Service Portal | Pages. From the list
view, find the index page that is our main homepage for our
custom portal.
2. As stated in the previous recipe, I follow the philosophy of forking
before you customize. Luckily, ServiceNow gives us a Clone
Page button, which will copy the entire page as is, leaving us free
to make any changes we like.
3. Click on the Clone Page button to get started:
2. ID: c8index
5. Now that we've got a new portal homepage, we'll want to update
our portal to point to it. Navigate to Service Portal | Portals and
find our Chapter 8 Service Portal to make these changes.
6. The Homepage value is a lookup field. Type-ahead with the ID
value, you used on the cloned page to change the homepage:
10. Once you've selected the page, you'll see a screen with a
hierarchical representation of all the components that form the
page itself. They're organized into containers and widgets:
Let's make some changes to the page by clicking on the Edit page
in Designer link mentioned before the graphic.
13. One other cool feature of the Page Designer is that it allows you to
preview your pages in different form factors such as tablets or
phone size screens. To see how this works, click on
the Preview link at the top of the screen.
On this page, the widgets are represented in dark blue. You can
highlight any of these to view and change the widget. Let's
highlight Simple List and take a look at how records are displayed
on the portal:
Each widget consists of an HTML template, a CSS section, and
two scripting sections—client's side and server's side. AngularJS is
included by default, and most features are supported within each
widget.
2. If you review the code, you'll note a global variable being called
frequently named c.options. This is a global variable that
references the Angular controller (c) and an array of settings
attached to it (options). These options are defined as a separate
configuration in each instance of the widget. Instances of widgets
use the same widget code, but with local versions of certain
variables such as options.
3. For the purposes of this recipe, our leadership wants to add an
additional list named My Changes. Since the title and table
referenced by the list are called out in the options, the good news
is we can reuse the Simple List widget to accomplish this.
4. Scroll up and click on the Edit Chapter 8 Index (c8index) page in
Designer link to open the designer:
5. Click, drag, and drop the 4-column container onto the designer. It
will automatically create itself wherever you drop it:
6. Once the new container is in place, you can drag and drop the
existing widgets to three of the new columns. Make sure to check
the options for each one to ensure they match. Next, you can
remove any existing widgets you no longer need:
7. Finally, we'll click, drag, and drop a new instance of the Simple
List widget into the fourth column:
8. Now that we have a new copy of the widget, let's configure the
options to have it reference the Change Request table.
9. Hover over the new widget and click on the edit (pencil) icon to
open up the options interface. Once in the options list, enter the
following values and click on Save:
2. Filter: active=true^assigned_to=javascript:getMyAssignm
ents()
3. Display Field: Short Description
There you go! As you can see, this is much easier than editing the
code directly and also saves a great deal of effort by making the
code reusable over time. Future updates to the Simple List widget
will automatically apply to every instance. Therefore, care should
be taken to ensure there is no regression with existing instances of
the code.
See also
Service Portal widgets: https://docs.servicenow.com/bundle/kingston-servicenow-
platform/page/build/service-portal/concept/c_Widgets.html
Building a new widget
So now we understand how to modify a page and reuse existing widgets,
but what about creating our own? Let's take a deeper dive into the widget
components and see what else we can accomplish.
Getting ready
To use this recipe, you should have an active ServiceNow instance
(Jakarta or Kingston), valid credentials, and admin role. If you've
provisioned a personal development instance during Chapter 1, Getting
Started with ServiceNow, that will be sufficient. In addition, to get the
most out of this section, you'll want to have gone through the first recipe
in this chapter, Configuring a portal, to have the portal settings and
components available that are referenced in the steps.
How to do it...
Open any standard web browser. As you can tell from screencaps, my
favorite to use is Chrome and follow these steps:
This will bring up the new widget interface. For the purposes of
this recipe, we will be using the HTML template, the client script,
and the server script panels.
<div>
<h1>
Hello, {{data.customer}}! Welcome to the Chapter 8 Widget!
</h1>
<h2>
Based on your user data, we see that you are part of the
{{data.department}} department
</h2>
<h2>
The following users are logged into your instance
<div ng-repeat="session in data.loggedInUsers">
<strong>{{session.name}}</strong>
</div>
</h2>
</div>
5. Please populate the Client Script section with the following (it's
the default value):
function() {
/* widget controller */
var c = this;
}
6. Please populate the Server Script section with the following, and
finally click on the Save button:
(function() {
data.customer = gs.getUserDisplayName();
data.department = '';
data.loggedInUsers = [];
var gr = new GlideRecord('sys_user');
gr.addQuery('sys_id', gs.getUserID());
gr.query();
while (gr.next()){
data.department = gr.department.name.toString();
}
var se = new GlideRecord('v_user_session');
se.addQuery('active',true);
se.query();
while (se.next()){
var session = {};
session.name = se.user.toString();
data.loggedInUsers.push(session);
}
})();
7. Once you've saved, you can click on the eye button right next to
the Save button to see a preview of what your widget will display:
This widget, or something like it, can now be added to any of your
pages.
There's more...
This is just a small example of using the power of AngularJS to set up
some HTML markup to receive data from ServiceNow, then run some
server-side code to retrieve values based on who is logged in, and give
some general data about the instance. You can expand on this as much as
you like to provide status or urgent messages, visualize configurations, or
integrate with third-party applications.
Understanding Discovery
Discovery is one of the more popular applications for customers once
their ServiceNow platforms is up and running. What Discovery does is
sends agentless probes out into specific IP ranges inside of your network
to discover devices and their attributes, as well as the software and other
middleware that might run on them. After running these probes, the data
can be populated into your Configuration Management Database
(CMDB) where work product from ITSM and other modules can be
applied or otherwise related to it. This is useful for understanding what's
happening where in your environments.
See also
Widget developer guide: https://docs.servicenow.com/bundle/kingston-
servicenow-platform/page/build/service-portal/concept/widget-dev-guide.htm
utorial.html
Overview of Additional
Modules and Kingston
In this chapter, we will be covering the following topics:
Understanding Discovery
Understanding Orchestration
Service Mapping
Cloud Management
Human Resources
Edge Encryption
1. Before you can use Discovery, you must first install the necessary
plugin from the Developer website. Navigate to https://developer.se
rvicenow.com, log in with your credentials, and connect to
1. Before you can use Orchestration, you must first install the
necessary plugin from the Developer website. Navigate to https://d
eveloper.servicenow.com, log in with your credentials, and connect to
1. Before you can use Service Mapping, you must first install the
necessary plugin from the Developer website. Navigate to https://d
eveloper.servicenow.com, log in with your credentials, and connect to
3. Let's take a quick look at the demo data to see what Service
Mapping looks like. Navigate to Service Mapping | Home |
Services | Business Services.
This will bring up the list view of defined Business Services, their
statuses, and criticality, as well as drill-down into a map of their
components and how they build on each other. Let's click on
the View map link under Customer Email:
From the Service Map, you'll see a visual arrangement of the
various nodes that combine to make the various services available.
This is not only useful for predicting impacts to your
infrastructure, but any change in status inside of the various nodes
can be configured to send appropriate alerts to parties affected and
personnel responsible for attending to those events:
See also
Service Mapping: https://docs.servicenow.com/bundle/kingston-it-operations-man
agement/page/product/service-mapping/reference/c_ServiceMappingOverview.html
Cloud Management
With so many organizations undergoing a lift and shift to the Cloud, it
becomes necessary for organizations to keep track of what's being
provisioned on various providers. The examples of this can be AWS,
Azure, and OpenStack. ServiceNow Cloud Management provides an
option for connecting to each of your cloud providers and centralizing a
view of those resources alongside your enterprise-hosted nodes.
Getting ready
To use this recipe, you should have an active ServiceNow instance
(Jakarta), valid credentials, and admin role. If you've provisioned a
personal development instance in Chapter 1, Getting Started with
ServiceNow, that will be sufficient.
How to do it...
Open any standard web browser. As you can tell from screencaps, my
favorite to use is Chrome and follow these steps:
1. Before you can use Cloud Management, you must first install the
necessary plugin from the Developer website. Navigate to https://d
eveloper.servicenow.com, log in with your credentials, and connect to
The installation process for the various plugins takes a set amount
of time, usually a few minutes, but can take longer. Once you get
the confirmation message, you can then navigate to your instance:
1. Before you can use GRC, you must first install the necessary
plugin inside your instance. Navigate to System Definition |
Plugins and search for GRC: Policy and Compliance Management. Once
you've located it, click on the Activate/Upgrade-related link in the
lower left:
2. Check the Load demo data box and then click on Activate. An
installation process dialog will run. Once it's complete, we can
move on to looking at the module!
3. To take a look at the GRC module, let's start by navigating
to Authority Documents. This list shows us our currently loaded
compliance frameworks and their categories. These will help us
define our controls and how they fulfill the various aspects of each
framework:
From each of these, you can categorize the intent of the statement
and track outstanding tasks intended to fulfill them:
1. Before you can use HR Service Delivery, you must first install the
necessary plugin inside your instance. Navigate to System
Definition | Plugins and search for Human Resources Scoped App: Core.
Once you've located it, click on the Activate/Upgrade-related link
in the lower left:
2. Check the Load demo data box and then click on Activate. An
installation process dialog will run. Once it's complete, we will
also install the Human Resources Scoped App: Service
Portal. Once you've located it, click on the Activate/Upgrade-
related link in the lower left:
3. Check the Load demo data box and then click on Activate.
1. Before you can use Edge Encryption, you must first install the
necessary plugin from the Developer website. Navigate
to https://developer.servicenow.com, log in with your credentials, and
connect to the Manage Instance interface.
2. From the My Instance console, you'll select the Action drop-down
menu and click on Activate plugin. This will bring up a list of
plugins you can install for experimentation. When you locate
ServiceNow Edge Encryption, click on ACTIVATE. If the option
is available to Include demo data, select that option for your
personal development instance:
The installation process for the various plugins takes a set amount
of time, usually a few minutes, but can take longer. Once you get
the confirmation message, you can then navigate to your instance:
All ServiceNow side tasks associated with Edge Encryption
require that you elevate your role to security_admin. This
can be accomplished by navigating to the profile menu in the
upper right and clicking on Elevate Roles.
1. Trigger: Created
Now that you have a finished flow, click on the Save button. Then,
you can click on Activate to make your flow occur every time the
conditions are met.
See also
Flow Designer: https://docs.servicenow.com/bundle/kingston-servicenow-platform/
page/administer/flow-designer/concept/flow-designer.html
Kingston – Agent Intelligence
Another of the highly anticipated features with Kingston is the Agent
Intelligence plugin. This module promises to enable machine learning and
predictive modeling to help organizations optimize their routing and
improve their processes.
ISBN: 978-1-78712-871-2
Learning ServiceNow
Tim Woodruff
ISBN: 978-1-78588-332-3