Form component setup

task brazil Updated Sep 10, 2026 16 min read form-component-uib-setup.md
Raw file servicenow.com

The Form component groups fields into sections based on the form layout configuration of the given view and provides user input fields.

Before you begin

This component contains a preset configuration. Presets automatically configure properties and event handlers for a component, making the component ready to work when you add it to a page. You can apply one preset to a single instance of a component on a page. For more information, see Automatically configure components using presets.

A preset connects to a controller, which acts as a data resource for the component. Controllers provide the configuration data and event binding the component needs to function in your experience. For more information see Bind data to UI pages using controllers.

This task assumes you have placed the component on the page and are ready to configure the properties and events. For instructions on accessing and using features in UI Builder, see Customize UI Builder pages using components.

Note: This document describes the latest component functionality. Go to the store to make sure you have the latest version of the component.

Role required: admin or ui_builder_admin

Procedure

  1. Define a label for Form that differentiates it from other components in the content tree.

    A descriptive label makes finding the component easier in a large list of components. For instructions on using the content tree, see Manage UI pages and page variants.

    [Omitted image "form-content-tree.png"] Alt text: Shows the content tree in UI Builder with the unique name for the form component

  2. Select the Form component, using one of these methods:

    • Click anywhere within the component.
    • Select the Action bar label you created for your component in the content tree. The preset selection panel appears in the pane on the right.

    [Omitted image "form-presets.png"] Alt text: Shows the list of presets for the form component

  3. Select either None to configure the component properties manually, or select one of the available presets to use pre-configured properties and events for the component.

    When you select the first preset on a page, a configuration panel appears with instructions for configuring the required controller for that preset. For more information, see Automatically configure components using presets

    [Omitted image "form-presets-config.png"] Alt text: Shows the preset configuration panel for connecting the preset to the required controller

  4. Supply the data that connects a preset to its controller and select Use.

    UI Builder automatically configures any other presets in the page to use the same controller with the same configuration. For more information, see Add a controller.

Parent Topic:UIB Setup Information

Form component properties

Properties in the Form component have preset configuration values. You can accept these values or override them manually.

Presets are intended to suit a specific use case. However, you can override a property that has a preset value with a custom configuration if necessary for your design. For details on overriding and resetting presets, see Override a component preset.

Important: Preset values that you override aren't updated automatically when you upgrade the instance.

Available presets

  • Record form

    This preset provides a complete record form with user input fields and related records. This preset requires the Form controller.

    Properties included in this preset are:

    • Sections
    • Fields
    • Table
    • Related Lists
    • Sys ID
    • View
    • Configuration
    • Changed Fields in serialized JSON string
    • Encoded Record
    • User Session information
    • Form Messages

Legacy form and multiple forms

You can have 2 or more forms on a page. However, if you want to add a form to a legacy page with an existing form, you must do the following:

  1. Because the legacy form controller doesn’t have a preset, you must add the Form controller preset to it:

    1. Select the data resource Form Controller.
    2. In the Edit Form Controller dialog, select Form controller preset from the list of presets. [Omitted image "form-form-controller.png"] Alt text: Edit form controller dialog with preset drop down expanded and Form controller preset selected
  2. When you add multiple forms to a page, the form controller for the first form you add is mapped to the page app shell. This mapping enables the form to communicate with the app shell elements, for example to display form information in a browser tab, and in notifications. When you already have a legacy form on a page and you add another form, you must specify which form you want to map to the page app shell:

    Note: The Is mapped to App Shell property is set on the form controller not the form component.

    1. Select the form controller for the form.

    2. In the Edit Form Controller dialog, scroll to the bottom of the list of properties in the Config tab.

    3. Select the Is mapped to App Shell property.

      [Omitted image "form-controller-maptoappshell.png"] Alt text: Edit Form Controller dialog scrolled to the bottom and showing cursor on the Is mapped to App Shell toggle

Form controller property

Label [property]

Description

Is mapped to App Shell[isMappedToAppShell]

To support multiple forms on a page, must be set to true for each unique Form controller instance.

Default: true for the first form placed on a page; false for a legacy form and for all other forms.

### Properties

Label [property]

Description

Table[table]

Table name for the record header.

Sys ID[sysId]

Sys ID for the record header.

Workspace ID[workspaceConfigId]

Sys ID for workspace configuration this record is in.

Query[query]

An encoded query string to filter the fields displayed.

Label [property]

Description

View[view]

View to use to display the record.

Forced view name[forcedViewName]

View to use to override the view designated using the view property.

Enable previous record button[enablePreviousRecordButton]

Shows or hides the previous button. When true, the previous button is visible and the previous record is available.Default: false

Enable next record button[enableNextRecordButton]

Shows or hides the next button. When true, the next button is visible and the next record is available.Default: false

Show nav record buttons[showNavRecordButtons]

Shows or hides the up and down navigation record buttons.Default: false

Sections[sections]

Sections used to group fields in the form. Sections can be manually set to an array of static values or linked to a data resource.

Fields[fields]

Array of field objects. Each object contains the information that is passed to the rendered field component.

Related Lists[relatedLists]

A list of records related to the current record.

Label [property]

Description

Hide form context menu[isContextMenuHidden]

Shows or hides the form context menu.Default: false

Hide "Jump to section navigation"[isSectionMenuHidden]

Shows or hides the context menu section "Jump to section navigation".Default: false

Hide "More form options"[isFormOptionsHidden]

Shows or hides the context menu section "More form options".Default: false

Hide "View"[isViewSectionHidden]

Hides view that is used to render the form when set to true. Default: false

Label [property]

Description

Hide all section titles[isSectionTitleHidden]

Shows or hides all the section titles. If disableCollapse is set to true, the entire section header is hidden.Default: false

Hide first section title[isFirstSectionTitleHidden]

Shows or hides the first section title. If disableCollapse is set to true, the entire section header is hidden.Default: false

Disable section collapsing[disableCollapse]

Lets user collapse sections.Default: false

Section Heading Level[sectionHeadingLevel]

Use to define the section heading level from 1 to 6 for the section headers.Default: 2

Label [property]

Description

Enable unsaved field indicator[enableUnsavedFieldIndicator]

Shows or hides a field-level indicator when a field is in an unsaved state. If set to false, an indicator in the form of a black dot appears next to each field with updates that aren't saved.Default: true

Enable unsaved field indicator background[enableBgColorForUnsavedFieldIndicator]

Enable unsaved field indicator must be set to true to use this property.Shows or hides a background color indicator that displays a background color to fields that have unsaved changes.

Default: false

Hide field context menu[isFieldContextMenuHidden]

Whether admins can access the field context menu. If set to false, the field context menu is hidden. When true, admins can't access the field context menu.Default: true

Label wrapping limit (px)[labelWrappingLimit]

Wraps the label instead of truncating it if the container width is less than the limit specified.Default: truncates the label

Label [property]

Description

Landmark[landmark]

Includes the component as a part of the keyboard shortcut landmark focus, allowing keyboard-only users to quickly navigate through a page and between primary components.Default: false

Label [property]

Description

Configuration[config]

Stores configuration details such as show/hide activity stream.Default: showActivityStream: false

Changed fields in serialized JSON string[serializedChanges]

Shows the serialized dirty fields string.

Encoded record[encodedRecord]

Contains properties for rendering the activity stream component.

User session Information[userSession]

Contains the user session information.Default: @context.session.user

Form messages[formMessages]

Messages that appear on the form.Array properties:

  • type: Type of message to be displayed. The message type determines how the notification is styled (error|info|warning).
  • message: The message to display.
### Manual configuration

To configure properties manually, enter either static or dynamic input. Enter dynamic input by selecting the input type.

Form component events

The Events tab shows the events used by the Form component. If you have chosen a preset containing events, data handlers for those events are pre-selected by the controller, and no manual configuration is required. If the component has events that aren't included in the preset, you must add data handlers manually to configure those events.

Events with presets are marked with the Preset badge. To show events that don't have preset configurations, select + Add event mapping. If the component has only one event, and that event doesn't have a preset, the event is displayed, ready for configuration.

[Omitted image "form-preset-events.png"] Alt text: Shows a partial list of the events with presets for the form component

Event handlers

Event handlers work with data resources to link the Form actions to the data you want to display to your users. Select the event in the list to add one or more event handlers.

For instructions on adding event handlers to an event, see Configure an event handler.

For instruction on how to add and delete event handlers with presets and how to disable an event, see Configure an event handler and Disable preset event mappings.

Preset events

  • Record form

    This preset provides data handlers for these events:

  • Preview Record
  • Item Selected
  • Add Notification
  • Remove Notifications
  • Clear Notifications
  • Remove form message
  • Screen Status Changed
  • Execute UI Action
  • Refresh Requested
  • Set Value
  • Add Option
  • Remove Option
  • Set Read Only
  • Set Visible
  • Show Related List
  • Hide Related List
  • Show Related Lists
  • Hide Related Lists
  • Clear Messages
  • Hide Field Message
  • Clear value
  • Hide All Field Messages
  • Set Label
  • Set Field Placeholder
  • Set Section Display
  • Set User Value
  • Add Info Message
  • Add Warning Message
  • Add Error Message
  • Show Field Message
  • Set Field mandatory
  • Reload Form
  • Save a form
  • Submit Form
  • Clear Choice Options
  • Add Form Message
  • Clear Form Message
  • Clear All Form Messages
  • Toggle Annotations
### Event descriptions

Event

Description

Preview Record

Action dispatched to preview a record.Payload:

  • table: The table to which the record being previewed belongs.
  • sys_id: The sys ID of the record being previewed.
  • query: Additional data passed to the component.
  • params: Properties passed to the component.
  • multiInstField: Field that is used in conjunction with route and params to support multiple instance of a content.

Item Selected

Primary navigation action that opens some content.Payload:

  • table: If the content to render is a record, the table of the record.
  • sys_id: If the content to render is a record, the sys Id of the record
  • parent_table: The table of the parent record.
  • parent_sys_id: The sys ID of the parent record.
  • render_type: Default is record. For typed renderers (non-record) it can be a custom string.
  • params: Properties passed to the component rendering the content.
  • path: Hierarchy support for breadcrumbs navigation. Objects in the list have the same shape as rest of the payload.

Add Notification

Informs the user of any errors while interacting with the component such as deleting or uploading an attachment. Action dispatched once the field declarative action execution has completed. This action is only dispatched when the record contains fields with field decorators.Payload contains items

  • type: Type of message to be displayed. The message type determines how the notification is styled (error|info|warning).
  • message: The notification message.

Remove notifications

Notifications are removed. Payload contains items: Array of notification objects to remove, identified by their IDs.

Clear notifications

Action to clear all notifications.

Remove form message

A single form message is removed, by index.Payload contains index: Index of the message to remove

Wrapped Action

Action that wraps an intended action in a payload.Payload:

  • wrappedAction: An intended action
  • wrappedPayload: Payload of an intended action

Screen Status Changed

Action dispatched to indicate that form is dirty.

Execute UI Action

Action that is dispatched to execute the specified UI Action.

Refresh Requested

Action dispatched on successful field declarative action executions for server script action. This action is only dispatched when the record contains fields with field decorators.

Set Value

User sets a value for a given field.Payload:

  • fieldName: Name of the field for which the value is being set
  • value: Value to which the field is being set
  • displayValue: Display value of the field being set

Add Option

Adds an option to a choice type.Payload:

  • fieldName: Name of the field to which the options is added
  • choiceValue: Value of the option
  • choiceLabel: Label of the option
  • choiceIndex: Index of the inserted option

Remove Option

An option is removed from a choice list.Payload:

  • fieldName: Name of a field
  • choiceValue: The choice value

Set Read Only

Sets a field to read-only when true.Payload:

  • fieldName: Name of the field to set to read-only
  • readonly: If true, set the given field read only

Set Visible

Sets the field visible if true. Makes the field hidden if false.Payload:

  • fieldName: Name of the field being set
  • visibility: If true, set the given field to visible

Show Related List

Shows the specified related list on the form.Payload: listTableName: Specifies the name of the related list to show

Hide Related List

Hides a specified related list on the form.Payload contains listTableName: Specifies the name of the related list to hide

Show Related Lists

Shows all related lists.

Hide Related Lists

Hides all related lists.

Clear Messages

Clear all form messages.

Hide Field Message

Hides the first (oldest) message by a field.Payload:

  • fieldName: Name of a field to hide a message
  • clearAll: Whether or not to clear all messages.

Default: false

Clear Value

The user clears the value of a given field.Payload contains fieldName: Name of the field whose value was cleared

Hide All Field Messages

Hide all field messages of a specific type.Payload contains type: The type of message to be hidden. The choices are:

  • info
  • warning
  • error

Set Label

Set the label of a specific field.Payload:

  • fieldName: Name of the field whose label is being set
  • label: Label to display for the field

Set Field Placeholder

Set placeholder text for a specific field.Payload:

  • fieldName: Name of the field for which placeholder text is defined
  • value: Value to set as the placeholder

Set Section Display

Show or hide a given form section.Payload:

  • sectionName: Name of the form section to show or hide
  • display: If true, shows a given form section.

Set User Value

Set a value for a given field via user input.Payload:

  • fieldName: Name of the field whose value is being set
  • value: Value to set in the field
  • displayValue: Display value to set

Add Info Message

Add a form message of type info.Payload contains message: The info message to display

Add Warning Message

Add a form message of type warning.Payload contains message: The warning message to display

Add Error Message

Add a form message of type error.Payload contains message: The error message to display

Show Field Message

Show a field message of a specify type.Payload:

  • fieldName: Name of the field displaying the message.
  • type: Message type. The choices are info, warning, and error.
  • message: Message to display.

Hide All Field Messages

Hide field messages of a specific type.Payload contains type: The choices are info, warning, and error.

Set Field mandatory

Makes the field required if set to true. Makes the field optional if set to false.Payload:

  • fieldName: Name of the field to set to mandatory
  • mandatory: If set to true, set the named field to mandatory

Reload Form

Reload the form with the same table and sysId.

Save a form

Save the current record.

Submit Form

Trigger form submission using the given UI action name.Payload contains submitActionName: Name of the UI action

Clear Choice Options

Clears all options for a choice list.Payload contains fieldName: Name of the field from which the choice list is cleared

Add Form Message

Add a form message of a given type.Payload:

  • message: Message to display
  • type: The choices are info, warning, and error.

Clear Form Messages

Clear all form messages of a given type.Payload contains type: The choices are info, warning, and error.

Clear All Form Messages

Clear all form messages.

Toggle Annotations

Hide all currently shown annotations or show all currently hidden annotations.

Form message button clicked

Event dispatched when a button in a form message is clicked.

Set transaction scope

Edit the form within the provided application scope.

Clear transaction scope

Clear the form's transaction scope.

Search documentation
Search document titles and file paths on the brazil branch