Types of variables

ServiceNow provides a set of 26 variable types.

The service catalog supports several types of service catalog variables, which are also referred to as questions. Some variable types accept variable attributes. You can also attach help text to any service catalog variable.

Refer to each variable for more information:

The following table shows the UI policy that does not apply to the variable/s listed against it.

Table 1. UI policy and variables
UI policy Variable
Mandatory Break, Container Start, Container End, Container Split, Label, Macro, Macro with Label, UI Page
Read only Break, Container Start, Container End, Container Split, Label, Macro, Macro with Label, UI Page
Visible Break, Container End, Container Split
Show Attributes When Type is One of Certain Values Macro, Macro with Label

Break

Displays a horizontal line across the form. Breaks are formatting elements. No data is collected.

The break variable is not yet supported on service portal and mobile devices.

Figure 1. Break

Check box

Creates a check box to enable/disable options by selecting/clearing it. List check boxes in order under a label to create a multi-option question (as shown in the figure).

Consecutive check box variables are automatically grouped under an Options label. If you want to define a label of your own, then group check boxes under a label variable. The default Options label is replaced with the label variable.

Figure 2. Check box

Container start, container split, container end

All three variables are used to define a layout for a container that can hold more variables. Use container start and container end variables to define the start and end points of a container layout. The container end must be used along with container start to close a container.

A container layout can be split into two or three columns using the container split variable. By default, the split is calculated at the 50% mark.

A container is similar to a variable set. Unlike a variable set, containers can be used anywhere (including inside a variable set) and can be nested (a container inside a container). Refer to KB0539982 for more information on using container variables.

To reproduce the container format as shown in the figure, do the following in the container start variable:
  • Select a Layout with 2 Columns Wide, alternating sides.
  • Select the check box for Display title to use a collapsible title bar.

The container variables are not yet supported on service portal and mobile devices.

Figure 3. Container

Date

Creates a date input widget to display a date value.

Figure 4. Date

Date and time

Creates a date and time input widget to display both date and time values. Time value is stored in Greenwich Mean Time (GMT) and displayed in the time zone of the current user.

Figure 5. Date and time

HTML

HTML variables are useful for providing more content for an item that requires more advanced formatting, including images.

The variable can be:
  • Used for user input.
  • Used for reusable content when put into a variable set (for example, terms and conditions).
  • Available in two modes: Edit and Read-only. In edit mode, a toolbar is available, and links do not work. In read-only mode, no toolbar is available, and links work. To switch between modes, use entitlements or create a UI policy to set the HTML field to read-only mode.
Attention: HTML variables are not supported for display on the shopping cart summary or approval summary screens. If the type is 'HTML', the available in summaries field is hidden in the variable form.

The HTML variable is not yet supported on service portal and mobile devices.

Figure 6. HTML

Label

Displays a label across the form. Labels are formatting elements. No data is collected.

Tip: You can use labels to arrange questions into sections. Use labels to create a multi-option question (for example, using check boxes).
Figure 7. Label

List collector

Uses the list collector slushbucket interface to add multiple records from a table.

The list collector variable is not yet supported on service portal and mobile devices.

Figure 8. List collector

Lookup multiple choice

Creates radio buttons using data from a table. Functionality is similar to lookup select box, which creates a choice list from queried data.

The lookup multiple choice variable is not yet supported on service portal and mobile devices.

Figure 9. Lookup multiple choice

Lookup select box

Creates a choice list using data queried from a table. Functionality is similar to lookup multiple choice, which creates radio buttons from queried data.

To create the lookup select box shown in the figure, enter the following values:
  • Lookup from table: Incident [incident]
  • Lookup value field: Sys ID
  • Lookup label field: number, category, priority
  • Reference qual: caller_id=javascript:gs.getUserID()^active=true

The lookup select box variable is not yet supported on service portal and mobile devices.

Figure 10. Lookup select box

Macro

Inserts a UI macro into the catalog item.

UI macros in the service catalog do not support the following glide_list functions: clickthrough, slushbucket editing, and email field.

Attention: Use phase one Jelly only for any UI macros added as variables. Phase two Jelly within the macro is not processed and appears on the page as standard content.

The macro variable is not yet supported on service portal and mobile devices.

Figure 11. Macro

Macro with label

Inserts a UI macro with a label.

The macro with label variable is not yet supported on service portal and mobile devices.

Figure 12. Macro with label

Masked

Inserts a text input box. Text entered in this text box is masked out, with each keystroke represented as an asterisk (*) symbol. Masked is useful for questions asking for sensitive or confidential data such as passwords.

The masked variable is not yet supported on service portal and mobile devices.

Figure 13. Masked

Multi-line text

Creates a multiple line text input widget.

Figure 14. Multi-line text

Multiple choice

Creates radio buttons for question choices.

Figure 15. Multiple choice

Numeric scale

Creates a horizontal set of radio buttons with numeric options from Scale min to Scale max (a Likert scale).

Figure 16. Numeric scale

Reference

References a record in another table. For example, a variable named point_of_contact references the User [sys_user] table.

Keep the following information in mind as you work with reference variables:
  • Reference variables use the auto-complete feature. To ensure that users have enough information, configure the reference lookup list.
  • Reference variables store the sys_id of the selected record (like reference fields). To use the display value in a script, use the same methods as for a reference field.
current.variables.<variable name>.getDisplayValue()
current.variable_pool.<variable name>.getDisplayValue()
Figure 17. Reference

Select box

Creates a choice list from pre-defined question choices.

Figure 18. Select box

Single-line text

Creates a single-line text input field.

The single-line text variable is not yet supported on service portal and mobile devices.

Figure 19. Single-line text

UI page

Inserts a UI page into the catalog item.

Attention: Use phase one Jelly only for any UI page added as variables, as phase two Jelly within the UI page is not processed and appears on the page as standard content.

The UI page variable is not yet supported on service portal and mobile devices.

Wide single-line text

Creates a single-line text input field that spans the form, allowing for longer input.

The wide single-line text variable is not yet supported on service portal and mobile devices.

Figure 20. Wide single-line text

Yes/No

Creates a choice list with Yes and No as options.

Figure 21. Yes/No

Service portal and mobile support for variables

The service catalog on mobile devices and service portal do not support the following variable types:
  • Break
  • Container variables
  • HTML
  • Label
  • List Collector
  • Lookup Multiple Choice
  • Lookup Select Box
  • Macro
  • Macro With Label
  • Masked
  • Single-Line Text
  • UI Page
  • Wide Single-Line Text