Function: Table(table)
Creates a table in a scoped application (sys_db_object).
Parameters
table
T & Table<S, E>
Properties:
-
name (required):
stringName of the table. Must be lowercase and include the application scope -
schema (required):
Record<string, Column>Array of column references that define the table's schema -
accessibleFrom (optional):
'public' | 'package_private'Application scopes that can access the table. -
actions (optional):
('read' | 'update' | 'delete' | 'create')[]List of access options for the table. -
allowClientScripts (optional):
booleanIndicates whether to allow design time configuration of client scripts on the table from other application scopes. -
allowNewFields (optional):
booleanIndicates whether to allow design time configuration of new fields on the table from other application scope. -
allowUiActions (optional):
booleanIndicates whether to allow design time configuration of UI Actions on the table from other application scopes. -
allowWebServiceAccess (optional):
booleanIndicates whether web services can make calls to the table. -
attributes (optional):
Record<string, string | number | boolean>Pairs of any supported dictionary attributes (sys_schema_attribute). -
audit (optional):
booleanIndicates whether to track the creation, update, and deletion of all records in the table. -
autoNumber (optional):
objectAuto-numbering configuration for the table.-
number:
number -
numberOfDigits:
number -
prefix:
string
-
-
callerAccess (optional):
'none' | 'tracking' | 'restricted'Access level for cross-scope requests. -
display (optional):
stringDefault display column. Use a column name from the schema. -
extends (optional):
keyof TablesThe name of any other table on which this table is based. -
extensible (optional):
booleanIndicates whether other tables can extend this table. -
index (optional):
object[]A list of column references to generate indexes in the metadata XML of the table. -
label (optional):
string | Documentation[]A unique label for the table on list and form views. -
licensingConfig (optional):
LicensingConfigConfiguration for table licensing. -
liveFeed (optional):
booleanIndicates if live feeds are available for records in the table. -
readOnly (optional):
booleanIndicates whether users can edit fields in the table. -
scriptableTable (optional):
booleanIndicates whether the table is a remote table that uses data retrieved from an external source. -
textIndex (optional):
booleanIndicates whether search engines index the text in a table.
See
Examples
Add Column to Existing Table
Add a custom string column to the existing incident table
/**
* @title Add Column to Existing Table
* @description Add a custom string column to the existing incident table
*/
import { StringColumn, Table } from '@servicenow/sdk/core'
export const incident = Table({
name: 'incident' as any,
schema: {
x_tablesample_custom_column: StringColumn({
label: 'Custom Column',
maxLength: 40,
}),
},
})
Table Extending Task
Create a table that extends task with auto-numbering and a reference column
/**
* @title Table Extending Task
* @description Create a table that extends task with auto-numbering and a reference column
*/
import { ReferenceColumn, Table } from '@servicenow/sdk/core'
export const x_tablesample_extends = Table({
name: 'x_tablesample_extends',
extends: 'task',
extensible: true,
display: 'Extension Example Table',
auto_number: {
prefix: 'sample',
number: 100,
number_of_digits: 9,
},
schema: {
user_reference_column: ReferenceColumn({
mandatory: true,
label: 'User Reference',
referenceTable: 'sys_user',
}),
},
})
Simple Table with Column Types
Create a table with string, integer, boolean, and date columns
/**
* @title Simple Table with Column Types
* @description Create a table with string, integer, boolean, and date columns
*/
import { Table, StringColumn, IntegerColumn, BooleanColumn, DateColumn } from '@servicenow/sdk/core'
export const x_tablesample_name = Table({
name: 'x_tablesample_name',
schema: {
string_column: StringColumn({ mandatory: true, label: 'String Column' }),
integer_column: IntegerColumn({ mandatory: true, label: 'Integer Column' }),
boolean_column: BooleanColumn({ mandatory: true }),
date_column: DateColumn({ mandatory: true }),
},
})
Related
🗃️ Columns
49 items