@servicenow/sdk - v4.7.0
    Preparing search index...

    Interface DataPolicy<T>

    Type representing the complete configuration of a Data Policy with metadata.

    interface DataPolicy<T extends TableName> {
        $id: string | number | ExplicitKey<string>;
        active?: boolean;
        applyToImportSets?: boolean;
        applyToSOAP?: boolean;
        conditions?: string;
        description?: string;
        inherit?: boolean;
        modelId?: string;
        reverseIfFalse?: boolean;
        rules?: Partial<Record<TableSchemaDotWalk<T>, DataPolicyRuleConfig>> & Record<
            string,
            DataPolicyRuleConfig,
        >;
        shortDescription?: string;
        table: T;
        useAsUiPolicyOnClient?: boolean;
    }

    Type Parameters

    Index

    Properties

    $id: string | number | ExplicitKey<string>
    active?: boolean

    Whether the Data Policy is active

    applyToImportSets?: boolean

    If true, enforces policy rules during import set transformations

    applyToSOAP?: boolean

    If true, enforces policy rules for SOAP/REST web service operations

    conditions?: string

    Encoded query string defining when the policy applies

    description?: string

    Detailed description of the Data Policy's purpose

    inherit?: boolean

    If true, applies this policy to all tables that extend the target table

    modelId?: string

    Document ID reference for model-based policies

    reverseIfFalse?: boolean

    If true, reverses the policy rules when condition is false

    Field-level rules (mandatory, read-only) keyed by field name. Each field can only have one rule.

    Type Safety Trade-off:

    • The Partial<Record<TableSchemaDotWalk<T>, ...>> part provides type safety and autocomplete for fields in the main table
    • The & Record<string, ...> index signature allows cross-table dot-walk notation (e.g., 'employee.department') and rules with explicit table properties that reference fields outside the main table

    This design prioritizes flexibility for cross-table rules over strict type safety, as Data Policies commonly need to enforce rules on fields in referenced tables that cannot be statically validated.

    shortDescription?: string

    A brief description of the Data Policy's purpose

    table: T

    The table to which the Data Policy applies (required)

    useAsUiPolicyOnClient?: boolean

    If true, also enforces as UI Policy on client side for immediate user feedback