Learning ServiceNow
eBook - ePub

Learning ServiceNow

Tim Woodruff

Condividi libro
  1. 356 pagine
  2. English
  3. ePUB (disponibile sull'app)
  4. Disponibile su iOS e Android
eBook - ePub

Learning ServiceNow

Tim Woodruff

Dettagli del libro
Anteprima del libro
Indice dei contenuti
Citazioni

Informazioni sul libro

IT Service management at your fingertipsAbout This Book• Leverage ServiceNow's capabilities to achieve improved service management and excellent results in your IT operations by following step-by-step, practical instructions• Build core administration, management, and maintenance skills with IT service management and IT operations management• Improve your workflow efficiency by designing and creating responsive and automated workflowsWho This Book Is ForThis book is for IT professionals and administrators who are planning to or are already trying to implement ServiceNow in their organization for Enterprise IT service management tasks.Some familiarity with web technologies (JavaScript) would be helpful. System administration experience is necessary.What You Will Learn• Acquire and configure your own free personal developer instance of ServiceNow• Read (and write!) clear, effective requirements for ServiceNow development• Avoid common pitfalls and missteps that could seriously impact future progress and upgradeability• Know how to troubleshoot when things go wrong using debugging tools• Discover developer "tips and tricks"• Pick up great tips from top ServiceNow development and administration professionals, and find out what they wish they knew when they were starting outIn DetailThis book shows you how to put important ServiceNow features to work in the real world. We will introduce key concepts and examples on managing and automating IT services, and help you build a solid foundation towards this new approach. We'll demonstrate how to effectively implement various system configurations within ServiceNow. We'll show you how to configure and administer your instance, and then move on to building strong user interfaces and creating powerful workflows.We also cover other key elements of ServiceNow, such as alerts and notifications, security, reporting, and custom development. You will learn how to improve your business' workflow, processes, and operational efficiency. By the end of this book, you will be able to successfully configure and manage ServiceNow within your organization.Style and approachThis book is a step-by-step practical tutorial to help you quickly deploy and configure ServiceNow in your organization.

Domande frequenti

Come faccio ad annullare l'abbonamento?
È semplicissimo: basta accedere alla sezione Account nelle Impostazioni e cliccare su "Annulla abbonamento". Dopo la cancellazione, l'abbonamento rimarrà attivo per il periodo rimanente già pagato. Per maggiori informazioni, clicca qui
È possibile scaricare libri? Se sì, come?
Al momento è possibile scaricare tramite l'app tutti i nostri libri ePub mobile-friendly. Anche la maggior parte dei nostri PDF è scaricabile e stiamo lavorando per rendere disponibile quanto prima il download di tutti gli altri file. Per maggiori informazioni, clicca qui
Che differenza c'è tra i piani?
Entrambi i piani ti danno accesso illimitato alla libreria e a tutte le funzionalità di Perlego. Le uniche differenze sono il prezzo e il periodo di abbonamento: con il piano annuale risparmierai circa il 30% rispetto a 12 rate con quello mensile.
Cos'è Perlego?
Perlego è un servizio di abbonamento a testi accademici, che ti permette di accedere a un'intera libreria online a un prezzo inferiore rispetto a quello che pagheresti per acquistare un singolo libro al mese. Con oltre 1 milione di testi suddivisi in più di 1.000 categorie, troverai sicuramente ciò che fa per te! Per maggiori informazioni, clicca qui.
Perlego supporta la sintesi vocale?
Cerca l'icona Sintesi vocale nel prossimo libro che leggerai per verificare se è possibile riprodurre l'audio. Questo strumento permette di leggere il testo a voce alta, evidenziandolo man mano che la lettura procede. Puoi aumentare o diminuire la velocità della sintesi vocale, oppure sospendere la riproduzione. Per maggiori informazioni, clicca qui.
Learning ServiceNow è disponibile online in formato PDF/ePub?
Sì, puoi accedere a Learning ServiceNow di Tim Woodruff in formato PDF e/o ePub, così come ad altri libri molto apprezzati nelle sezioni relative a Informatik e Unternehmensanwendungen. Scopri oltre 1 milione di libri disponibili nel nostro catalogo.

Informazioni

Anno
2017
ISBN
9781785887536
Edizione
1
Argomento
Informatik

The Server-side Glide API

In 2003, CEO Fred Luddy started a company called GlideSoft, which specialized in IT Service Management applications. Three years later, the company changed its name to ServiceNow, but the Glide name stuck for the API!
The Glide API is available on both the server and the client (though only a subset of the API is available on the client), and it consists largely of several classes about which we'll learn in this chapter; several of which are:
  • Server-side Glide classes:
    • GlideRecord
    • GlideAggregate
    • GlideElement
    • GlideDate and GlideDateTime
    • GlideSession
    • GlideSystem
  • Client-side Glide classes:
    • GlideRecord
    • GlideAjax
    • GlideForm
    • GlideList2
    • GlideMenu
    • GlideUser
Each class in the Glide API may consist of methods (executable functions within the class), and properties (variables stored within the class, which may be set on initialization of a new instance of the class).
This chapter largely consists of API documentation. We recommend that you read through it once, and then dog-ear this chapter so that you can come back to it for reference later on.

The structure of an API class

First, let's define a few terms. According to Mozilla's object-oriented JavaScript documentation, a class is sort of like a template for an object. It pre-defines the methods and properties of an object generated from the class.
An object therefore, is simply an instance of a class!
A method is a function or subroutine that's declared as part of a class (and any objects that are instances of that class).
A constructor is a special type of function that runs when an object is declared as a new instance of a class using the new keyword. In ServiceNow, this constructor function is usually called initialize. Any arguments passed into the class during instantiation will be passed into this function, which effectively builds the object that will be returned.
Naming convention dictates that while variable names use camelCase capitalization, class names use SentenceCase capitalization.
Here is a simple example of what a very simple class might look like:
 var MyClass = Class.create(); 
MyClass.prototype = {
initialize: function(initArg) {
this.localProperty = initArg;
},
getLocalProperty: function() {
return this.localProperty;
},
type: 'MyClass'
};
Now let's break this down line-by-line, and see how it works.
On line 1, we declare our class (MyClass) using a special ServiceNow API, Class.create(). As it happens, JavaScript doesn't technically have a data type called Class. Instead, it relies on function/object prototype extensions. In order to simplify this, and provide syntax more similar to the backend Java (and more similar to what most object-oriented programming languages use), ServiceNow provides Class.create() as a simple way to generate a basic class-esque object.
On line 2, we take this basic class scaffolding that we generated on line one, and extend that prototype by adding some stuff to it (everything between the curly braces: { and }).
On line 3, we declare the initialize method. This is a special method of our class, which is called automatically whenever a new object is generated (instantiated) from our class using the new keyword like so:
 var myObj = new MyClass('input'); 
Any arguments passed into this instantiation process (the string input in the preceding case), are passed into this initialize method.
Next, on line 4, we set a property in the scope of the instantiated object using the keyword this. In this case, any time we create an instance of this class, the property called localProperty will be initialized with the value that was passed into the constructor function.
On line 6, we declare another method called getLocalProperty. This is a method that can be called from objects created from our class, and which (on line 7) returns the value of the property that was set on initialization.
Finally, on line 9, we declare the type property of our class (and instantiated objects). This is just a string that you can access to determine what class child objects were created from.

Server-side APIs

Server-side APIs consist of classes and methods that are available to scripts executing on the server. When a script executes on the server, it is able to do so because of an open-source implementation of JavaScript, written in the Java programming language, called Mozilla Rhino. This allows us to interact with Java applications such as ServiceNow by scripting in JavaScript, despite the fact that the languages are not inherently cross-compatible.

GlideRecord

The GlideRecord class is one of the most ubiquitous and useful classes in ServiceNow. Its primary function is to query a database table, and present values corresponding to each record in that table, that matches a given query. It can also be used to add, modify, or delete records. A GlideRecord object consists of properties with names corresponding to each field in the table. In the client-side Glide API, these properties usually contain strings, whereas on the server-side API, these properties contain GlideElement JavaScript Objects with their own methods and properties.

Initialize

A GlideRecord object must first be initialized by using the new keyword (which calls the initialize() constructor method) and passing in a table name as a string. This tells the new GlideRecord object what table any subsequent queries or new records are created on.

Example usage

Initialize a new GlideRecord object on the Incident table, and store it in the gr variable:
 var gr = new GlideRecord('incident'); 

addQuery()

The addQuery() method of the GlideRecord class can be called in three different ways, depending on whether one, two, or three arguments are supplied to it. If one argument is passed into the addQuery() method, then it'll assume that the argument is an encoded query. Encoded queries are a single string that represents all of the conditions in a single query (or even multiple queries)!
There isn't any official documentation on how to construct an encoded query (though it isn't hard to figure out), but there is a very easy to build one yourself - simply navigate to the table you want to run the query on, and use the query builder! For example, here's a query on the incident table where the "assigned to" user is active, and either the Incident is active, or the state is set to new, in progress, or on hold:
You can build a filter on a given table using the query builder, and then apply that same filter to your GlideRecord query by simply right-clicking the last condition in the query breadcrumbs above the list view, and clicking on Copy query.
This is similar to the legacy addEncodedQuery() method:
You'll see an example of this single-argument usage in the following section. On the other hand, if you pass in two arguments, then it is assumed that the first argument is the field name, and the second argument is the expected value.
Finally, if you pass in three arguments to the addQuery() method, you may specify not only a field and value, but an operator between them. Operators that you can...

Indice dei contenuti