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 than255
, 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, theChoices
[sys_choice
] table, stores the options and labels. This lets the platform convertwip
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 representClosed
. 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 [s
ys_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