Docs
On this page
reference2 min readApplication: Platform

TableProtected and TableChecks

TableProtected, the predefined TableChecks sets and the option methods that decide which permissions, validations, triggers and events a script applies.

TableChecks is the set of checks that apply when a server script reads or saves records: permissions, restrictions, validation, triggers, events and field protection. TableProtected is a Table that applies all of them, as the UI does for a user.

Get an instance

The TableChecks global holds the predefined sets, such as TableChecks.DefaultChecks. A Table or TableRecord returns its current set from tableChecks().

Where you apply a set Effect
Table(tableName, checks) or TableProtected(tableName, checks) The Table and every record it returns use the set. This is the only way to change the table read access check.
table.tableChecks(checks) Changes the set on a Table you already have, for the records it returns after that.
record.tableChecks(checks) Changes the set on one record.
record.withTableChecks(checks, callback) Uses the set for the function only, then restores the previous set.

TableProtected

Method Returns Description Since
TableProtected(tableName, ...) Table or TableRecord Takes the same arguments as Table and returns the same objects, with DefaultProtectedChecks instead of DefaultChecks. 1.11
TableProtected.withoutTableReadAccessCheck(tableName) Table A protected Table with only the table-level read check turned off. Record and field permissions, restrictions and tenancy still apply. 1.11

Use withoutTableReadAccessCheck to read a parent table such as Work when the user may read some of its child tables but not the parent. Limit the query to the user’s own records, and drop records for which canRead() returns false.

let work = TableProtected.withoutTableReadAccessCheck("Work")
    .OR(EQUAL("Requestor", userId), EQUAL("RequestedFor", userId))
    .query();

Predefined sets

Each set is a property of the TableChecks global. Audit is on in every set.

Method Returns Description Since
TableChecks.DefaultChecks TableChecks The set Table uses. Validation, triggers, field values, events, workflow and field protection are on. Permissions, table read access, record restrictions and tenancy are off. 1.11
TableChecks.DefaultProtectedChecks TableChecks The set TableProtected and user requests use. Every check is on. 1.11
TableChecks.ValidationTriggersValuesEventsNoPermissionsNoRestrictionsNoTenancy TableChecks Same as DefaultChecks. 1.11
TableChecks.AllChecksValidationTriggersValuesAndEvents TableChecks Same as DefaultProtectedChecks. 1.11
TableChecks.NoTableChecksNoEvents TableChecks Only field default values, workflow and the system field update are on. 1.11
TableChecks.NoTableChecksWithEvents TableChecks As NoTableChecksNoEvents, with events on. 1.11
TableChecks.NoTableChecksWithEventsAndValues TableChecks As NoTableChecksWithEvents, with field values on. 1.11
TableChecks.NoTableChecksNoSystemFieldsNoChecksNoEvents TableChecks Everything is off except audit. System fields such as UpdatedOn are not updated. 1.11

withPreventUpdates is off in every set.

Option methods

Each option is a method. With no argument it returns whether the option is on. With true or false it returns a changed copy of a predefined set, or applies the change to the Table or TableRecord you call it on and returns that object.

Method Returns Description Since
withCheckPermissions(flag) TableChecks Applies the permission model to each record and field. 1.11
withCheckTableReadAccess(flag) TableChecks Checks that the user may read the table when the Table is created. Takes effect only in a set passed to Table or TableProtected. 1.11
withApplyRestrictions(flag) TableChecks Applies table record restrictions. 1.11
withApplyTenancyRestrictions(flag) TableChecks Applies the multi-tenancy restrictions. 1.11
withValidationEnabled(flag) TableChecks Runs server-side field validation. 1.11
withTriggersEnabled(flag) TableChecks Runs triggers. 1.11
withEvaluateFieldValues(flag) TableChecks Evaluates field value scripts. 1.11
withFieldDefaultValuesEnabled(flag) TableChecks Applies field default values. 1.11
withFireEventsEnabled(flag) TableChecks Fires events. 1.11
withWorkflowOperationsEnabled(flag) TableChecks Runs workflow operations. 1.11
withManagedFieldsProtected(flag) TableChecks Protects managed fields, such as WorkflowStatus, PreviousTransition, PreviousWorkflowStatus, QuestionsSource, SystemRealm and SystemRealmCIDR, from change. 1.11
withSystemFieldsProtected(flag) TableChecks Protects system fields, such as ID, UpdatedOn, CreatedOn, Version and TableClass, from change. 1.11
withUpdateSystemFields(flag) TableChecks Updates system fields, such as UpdatedOn and UpdatedBy, on save. 1.11
withPreventUpdates(flag) TableChecks Stops any change to existing records. 1.11
toString() String Returns the set’s name, or its changes from a named set. 1.11
toDebugString() String Returns the set’s name and the value of every option. 1.11

Audit has no option method. A script cannot turn audit off through TableChecks.

Turn checks off only when the normal user path does not apply:

  • Data import, integrations and bulk updates can turn off validation, field values, default values, triggers, workflow and restrictions.
  • A trigger that must look up records the user cannot see, such as users, groups or configuration items, can turn off permissions and restrictions.
  • A script that creates related records the user may not create, such as time cards, can turn off permissions.
  • A data correction can turn off the system field update, so UpdatedOn and UpdatedBy keep their values.
  • A very large import can turn off events, as a deliberate performance measure.

Examples

Apply checks to a whole query

Set the checks once on the query. Every record it returns uses them.

Table("Incident")
    .EQUAL("Number", "<number>")
    .tableChecks(TableChecks.DefaultChecks.withUpdateSystemFields(false))
    .forEach(rec => {
        rec.ShortDescription("<short description>").update();
    });

Change checks on current for one block

withTableChecks restores the checks on current after the function, so other scripts in the save are not affected.

current.withTableChecks(TableChecks.NoTableChecksNoSystemFieldsNoChecksNoEvents, () => {
    current.ProtectedField("<value>");
});

Inspect a set

Servicely Script

TableChecks.DefaultChecks
    .withTriggersEnabled(false)
    .withTriggersEnabled();

Response

false
Last updated 19 October 2026commit f1879fd7e955Chris Jones
Back to top