Skip to content
Tutorials Center
My learning

Topics

Lesson 10 of 39 ยท Tables and Data Model

Field Types

Tour the ServiceNow field types: string, integer, choice, reference, glide list, journal, date/time, true/false and more, with display value versus value and choice lists.

When you add a column, the most important decision is its type. The type controls how the value is stored, how it appears on forms and lists, how it is validated and what operators filters offer. This lesson tours the types you will use daily.

The common types

Type Stores Typical use
String Text up to a maximum length Short description, names
Integer Whole number Counts, durations in seconds
Decimal / Floating point Numbers with fractions Costs, scores
True/False Boolean Active, flags
Choice One option from a list State, category
Reference The sys_id of a record in another table Caller, assigned to
Glide List A list of reference sys_ids (comma separated) Watch list, additional assignees
Date A calendar date Due date
Date/Time Date and time (stored in UTC) Opened at
Duration A length of time Business duration
Journal / Journal Input Append-only text history Work notes, comments
HTML / Script / JSON Rich text or code Descriptions, scripts
Conditions A saved filter Reports, rules
Document ID Reference to a record in any table Generic links
Currency / Price Money Cost fields

Value versus display value

A field has a value (what is stored) and a display value (what people read). For most types they are equal. They differ for:

  • Choice: stored 2, displayed "In Progress".
  • Reference: stored the 32-character sys_id, displayed the referenced table's display field (a user's name).
  • Date/Time: stored in UTC, displayed in your time zone and format.

Scripts get this wrong more than anything else. Reading current.state returns the value ("2"), while getDisplayValue('state') returns "In Progress". Comparing a reference to a name string never matches; compare to a sys_id.

Python Value versus display value (stand-in)

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

Choice fields

A choice field stores one of a set of options kept in the sys_choice table. Each choice has a Label (shown), a Value (stored), a Sequence (order) and a Language. Configure them from the form: right-click the field, Configure Dictionary (to change the field) or Show Choice List; or open System Definition > Choices.

Good practice: keep stored values stable and short (numbers or lowercase words) and change only the label for a rename. When adding choices to a field that out-of-the-box processes use (like incident state), remember business rules may depend on the numeric values.

Reference fields

A reference field points to a record in another table. In the dictionary you choose Reference = the target table (sys_user), and optionally a reference qualifier that limits what can be chosen (for example only active users in a group). The form shows a lookup icon, an auto-complete list, and a preview icon for the referenced record.

References create relationships: incident.caller_id points to sys_user. The next-but-one lesson, Reference Fields and Dot-Walking, shows how to travel through them.

Journal and history fields

Work notes and additional comments are journal fields. You cannot edit past entries; you only add new ones. The entries are kept in the sys_journal_field table rather than in the incident row itself, so scripts read them through the journal API instead of like a plain string column.

Other things on the dictionary entry

Each column's dictionary entry (sys_dictionary) also holds:

  • Mandatory and Read-only flags (a data-level setting, as opposed to a UI policy).
  • Default value (a literal or a script like javascript:gs.getUserID()).
  • Max length, Unique, Display (this column is the table's display value), Active, Attributes (extra options such as edge_encryption).
  • Calculated (a script computes the value).
Python Choose a field type (stand-in)

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

Adding a column

  1. Open System Definition > Tables, open your table, and in Columns press New.
  2. Set Column label, let the Column name generate (u_ prefix for global custom columns), choose Type, and set Max length or the Reference table.
  3. Tick Mandatory or Read only only when it is a true data rule.
  4. Save, then add the column to the form (Form Layout) so users can see it. Adding a column to the table does not automatically put it on a form.

Check your understanding

Quick check ยท 4 questions

of 4 answered You scored / 4 ยท perfect!

  1. 1. What does a reference field store?

    The stored value is the sys_id; the form shows the display value.
  2. 2. What is a good way to rename a choice for users?

    Labels can change freely; stored values should remain stable because scripts depend on them.
  3. 3. Which type suits an append-only history of notes?

    Journal fields keep each entry with author and time and cannot be edited afterwards.
  4. 4. Date/Time values are stored in which time zone?

    The platform stores UTC and converts for display.

Summary

  • Pick the field type that matches the data: choice for options, reference for another record, journal for history.
  • Value and display value differ for choices, references and dates.
  • Choice rows live in sys_choice; keep values stable.
  • Adding a column to the table does not add it to forms.

Next: Table Extension and the Task Table