Create a table

Administrators and application developers can create custom tables to store application data.

Before you begin

Role required: admin

Procedure

  1. Navigate to System Definition > Tables.
  2. Click New and complete the form.
    Control Description
    Label Enter a unique label for the table (such as Laptops or Thin Clients). The label appears on list and form views for the table. Updating the Label field also updates the label record in the language file for the current language.
    Name
    Edit the table name, which is automatically populated based on the table label and a prefix as follows:
    • For a table in a scoped application, the name is prefixed with a namespace identifier to indicate that it is part of an application.

    Preface the name of the table with u_cmdb_ci_ to make it similar to the other CMDB classes (for example, u_cmdb_ci_laptop).

    You cannot modify the prefix; however, you can modify the rest of the table name. The name can contain only lowercase, alphanumeric ASCII characters and underscores (_).

    Extends Table

    Select the table to extend. Extending a base table incorporates all of the fields of the original table and creates system fields for the new table. You can extend tables that are marked as extensible if they are in the same scope or if they allow configuration from other scopes.

    For example, if the new class is Laptops, which is a subclass of Computers, select the cmdb_ci_computer table. If the new class is a top-level class, select the cmdb_ci table.

    This option is available only when creating a table.

    Application [Read only] Displays the application associated with this table. If you are working on an application or are creating a table from an application record, the field defaults to that application. Otherwise, the field defaults to Global. Any records that are created from the table record, such as modules and security rules, are assigned to this application by default.
    Create module

    Select the check box and then complete the Add module to menu field to create a list module in the application menu.

    This option is available only when creating a table.

    Add module to menu Select an existing menu or select Create new and enter a new menu name. This option is available only when the Create module check box is selected.
  3. In the Columns section, use the Table Columns embedded list to add columns to the table.
    Column Description
    Column label
    Define a unique label for the column. The label appears on list headers and form fields for the column.
    • When you update the Column label field, the system also updates the label in the language file for the current language.
    • When you create a new column, the column name is automatically populated based on the label. The name is automatically prefixed with u_ to indicate that it is custom. For example, if you enter Activity Description as the column label, the column name defaults to u_activity_description.
    Type [Mandatory] Define the field type for the column. To preserve existing data, only change fields between the same basic type (for example, Choice and String). A warning appears if a change to a custom field will result in data loss. For a base system field, you cannot make a change that will result in data loss.
    Reference

    Make the field into a reference field by entering the referenced table name.

    Note: Dynamic reference creation is enabled for this field. So, if you enter a table name that does not match an existing table, a new table is created when you save changes to the current table record. If the current table has a module in the application navigator, then a module for the newly created table is automatically created in the same application menu.
    Max length

    [String fields only] Limit the length of the field. A length of under 254 appears as a single-line text field. Anything 255 characters or over appears as a multi-line text box.

    Note:
    • You can only change this value if the Type of the field is String. Changes for any other type of field are ignored.
    • Users on an Oracle instance cannot increase the maximum length of a string field to anything greater than 4000 through the application UI because this requires the CLOB datatype in Oracle. To increase beyond this size, log an incident with ServiceNow Technical Support to request the change.
    • To prevent data from being lost, only decrease the length of a string field when you are developing a new application and not when a field contains data. A warning appears if a change to a custom field will result in data loss. For a base system field, you cannot make a change that will result in data loss.
    Default value Specify the default value of the field for any new record. Ensure that this value uses the correct field type. For example, an integer field can use a default value of 2 but cannot use a default value of two. These values can be overridden with dictionary overrides.
    Display

    Indicate whether this field is the display value for reference fields (appears on records that reference this table).

    Note: This option does not control whether or not this field is displayed on lists or forms.
  4. In the Controls section, define additional table options.
    Control Description
    Extensible Select the check box to allow other tables to extend this table. Clear the check box to prevent the creation of additional child tables; existing child tables remain unchanged.
    Live feed Select the check box to enable record feeds for the table. This option adds the Show Live Feed icon (Show Live Feed icon) in the form header.
    Auto-number Select the check box, and then define the number format to add an auto-numbered field to the table. The check box is available only when a number format does not exist for the table. Otherwise, you can edit the existing number format.
    Create access controls Select the check box and then complete the User role field to create basic security rules for the table.
    User role Enter a new name or select an existing user role that is required to access this table. This option is available only when the Create access controls check box is selected.
  5. In the Application Access section, define the scope protection for the table.
    Control Description
    Can read Select the check box to allow script objects from other application scopes to read records stored in this table. This option offers runtime protection. For example, a script in another application can query data on this table. You must first select read access to grant any other API record operation.
    Can create

    Select the check box to to allow script objects from other application scopes to create records in this table. This option offers runtime protection. For example, a script in another application can insert a new record in this table. This option is available only when the Can read check box is selected.

    Clear the check box to prevent script objects from other application scopes from creating records in this table.

    Can update

    Select the check box to allow script objects from other application scopes to modify records stored in this table. This option offers runtime protection. For example, a script in another application can modify a field value on this table. This option is available only when the Can read check box is selected.

    Clear the check box to prevent script objects from other application scopes from modifying data stored in this table.

    Can delete

    Select the check box to to allow script objects from other application scopes to delete records from this table. This option offers runtime protection. For example, a script in another application can remove a record from this table. This option is available only when the Can read check box is selected.

    Clear the check box to prevent script objects from other application scopes from deleting records from this table.

    Allow access to this table via web services

    Select the check box to allow users to make inbound web service queries to this table. This option offers both design-time and runtime protection. The user performing the query must have the correct permissions to access this table, even when this check box is selected.

    Clear the check box to prevent users from making web service queries to this table.

    Allow configuration

    Select the check box to allow applications from other application scopes to create configuration records for this table that change its functionality. For example, an application designer can select this table from the Tables list on business rules, client scripts, or UI actions. This option offers design-time protection.

    Clear the check box to prevent application designers from selecting this table when creating configuration records.

  6. Click Submit.