Book Image

Mastering ServiceNow - Second Edition

Book Image

Mastering ServiceNow - Second Edition

Overview of this book

ServiceNow is a SaaS application that provides workflow form-based applications. It is an ideal platform for creating enterprise-level applications giving requesters and fulfillers improved visibility and access to a process. ServiceNow-based applications often replace email by providing a better way to get work done. The book steps through the main aspects of the ServiceNow platform, from the ground up. It starts by exploring the core architecture of ServiceNow, including building the right data structure. To add business logic and control data, and interactivity to user interaction, you will be shown how to code on both server and the client. You will then learn more about the power of tasks, events and notifications. The book will then focus on using web services and other mechanisms to integrate ServiceNow with other systems. Furthermore, you will learn how to secure applications and data, and understand how ServiceNow performs logging and error reporting. You will then be shown how to package your applications and changes, so they can be installed elsewhere and ways to maintain them easily. If you wish to create an alternative simple interface, then explore ways to make ServiceNow beautiful using Service Portal. By the end of the book, you will know the fundamentals of the ServiceNow platform, helping you be a better ServiceNow System Administrator or developer.
Table of Contents (18 chapters)
Mastering ServiceNow Second Edition
Credits
Notice
About the Author
About the Reviewer
www.PacktPub.com
Preface

Storing data


There are various types of fields provided by the ServiceNow platform. We will explore some of the simpler ones before moving on to the fundamental backbone of the data structure with reference fields:

  • String: These fields are simple text fields. The UI displays a string field as an editable text box. If the Max length attribute in the dictionary is more than 255, then a multiline field is shown. Most fields in ServiceNow are enhanced versions of the string field.

  • Choice: These fields are string fields, but rendered as HTML select fields. The value that is stored in the database is plain text. Another table, the Choices [sys_choice] table, stores the options and labels. This lets the platform convert wip in the database to present Work in Progress to the user. Any values that don't have a label are highlighted in blue in the dropdown.

  • Integer choice: These fields use numbers instead of text to achieve the same result as normal choice fields. They are useful for representing states, since they allow you to use greater-than or less-than conditions, but they have proven difficult to work with since the numbers don't mean much!

    Tip

    Use caution when dealing with the out-of-the-box integer choice fields, such as State on the Task table. If you reuse them (which is a good idea), you should always align your states to the existing ones. For example, 3 should represent Closed. If you do not align them, then users will be confused when reporting. This is discussed in detail in Chapter 4, Client-Side Interaction .

  • Date: There are several date fields in ServiceNow. The time is stored as UTC in the database, and the appropriate display value is calculated by the user's profile.

  • Currency: These are string fields that combine the currency and amount. USD;1000 represents $1,000. The platform uses this information to provide conversions between different currencies. For example, if I prefer to see amounts in GBP, the platform will, if it has the latest currency rates, display £675.

  • True/false: These fields are simple boolean values in the database. They are rendered as tick boxes.

  • URL: These fields provide space to enter a link, which can toggled to be clickable.

  • Email: Similar to URL, the email field lets you type an e-mail address and provides a button to launch your e-mail client through a mailto: link.

  • HTML and Wikitext: Other fields, such as these, provide different interfaces to manipulate strings. It is tempting to use HTML fields in lots of places, but they do come with overhead, and browsers have different capabilities. Test carefully if you want to use capabilities such as these.

Storing files as attachments

In addition to text, ServiceNow can also store binary data. This means that anything (images, music, or even a multitude of PowerPoint documents) can be saved in ServiceNow. Just like everything else, binary data is stored in the database. However, rather than using a BLOB field, binary data is split into 4-KB chunks and saved into the Attachment Documents (sys_attachment_doc) table. Each chunk of a file refers back to the Attachments (sys_attachment) table, where the filename, content type and size, and other metadata are stored.

A file is always related to another record (this is why they are referred to as attachments). Information on this other record is stored with the other metadata in the Attachments table. For example, if a record had a PDF of the booking form attached to it, the Attachment record would contain the filename of the document as well as the sys_id of the Reservation record.

Tip

We'll see in later chapters that there are often better ways than manually adding attachments containing booking information. Why not have the e-mail come directly into ServiceNow? (We'll see how in Chapter 5, Getting Things Done with Tasks.) Or, even better, why not have the guests perform the booking directly with ServiceNow? (Chapter 10, Packaging with Applications, Update Sets, and Upgrades, will show us how to do this.)

Setting properties

One of the simplest ways to control the platform is to set properties. There are lots of things you can change by just clicking on a box or changing a value. And just like everything else in ServiceNow, the configuration properties that you set are stored in a table-the System Properties [sys_properties] table to be precise.

To see how many options you can choose, type Properties in the filter-text box of the application navigator. Many matches will be shown, including System Properties > UI Properties. This collection contains some very useful options, including how forms look and feel, whether list editing is enabled, and whether Insert and Stay is always available. You may want to spend some time and find out what they do.

Some properties are not categorized, but all are accessible by typing sys_properties.list in the filter-text box of the application navigator. This will give you a large list-over 1000 in Helsinki.

Note

This book will guide you to the more relevant properties, but many are documented in the product documentation: https://docs.servicenow.com/administer/reference_pages/reference/r_AvailableSystemProperties.html