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

    Interface InboundEmailAction<T>

    interface InboundEmailAction<T extends TableName> {
        $id: string | number | ExplicitKey<string>;
        $override?: Record<string, string | number | boolean>;
        action: "record_action" | "reply_email";
        active?: boolean;
        assignmentOperator?: string;
        conditionScript?: string;
        description?: string;
        eventName?: string;
        fieldAction?: string;
        filterCondition?: string;
        from?: string | Record<"sys_user">;
        name?: string;
        order?: number;
        protectionPolicy?: "read" | "protected";
        replyEmail?: string;
        requiredRoles?: (string | Role)[];
        script?: string | ((...args: unknown[]) => void);
        stopProcessing?: boolean;
        table?: T;
        type?: "new" | "reply" | "forward";
    }

    Type Parameters

    Index

    Properties

    $id: string | number | ExplicitKey<string>
    $override?: Record<string, string | number | boolean>

    Set properties not directly supported by this API.

    action: "record_action" | "reply_email"

    Action type that creates or updates a record. Default: 'record_action'

    active?: boolean

    Whether the inbound email action is active. Default: false

    assignmentOperator?: string

    Assignment operator for field actions. Only available for 'record_action' action type.

    conditionScript?: string

    Condition that must evaluate to true for the action to execute. If you include the condition in the script itself, leave this field blank.

    description?: string

    Documentation explaining the purpose and function of the action

    eventName?: string

    Event name that triggers this action. Default: 'email.read'

    fieldAction?: string

    Field action template defining field values to set on the target record. Uses ServiceNow's encoded query format with special syntax for dynamic values:

    • Static values: field=value (e.g., active=true, priority=1)
    • Static reference (sys_id): field=<sys_id> (e.g., assigned_to=62826bf03710200044e0bfc8bcbe5df1)
    • Datetime: field=YYYY-MM-DD HH:MM:SS (e.g., activity_due=2026-03-17 00:00:00)
    • Dynamic from sys_filter_option_dynamic: fieldDYNAMIC<sys_id> (e.g., short_descriptionDYNAMICb637bd21ef3221002841f7f775c0fbb6)
    • Comma-separated list: fieldDYNAMIC<sys_id1>,<sys_id2>,<sys_id3> (e.g., additional_assignee_listDYNAMIC0a826bf03710200044e0bfc8bcbe5d7a,be82abf03710200044e0bfc8bcbe5d1c)
    • Dynamic from email: Fields can be set from email properties (Subject, Body, Recipients, Sender, Sender->Company, etc.)
    • Text queries: 123TEXTQUERY321=value
    • Separator: ^ between fields, ending with ^EQ

    Example: field1DYNAMIC<sys_id1>^static_field=value^field2DYNAMIC<sys_id2>^field3DYNAMIC<sys_id3>^EQ

    Only available for 'record_action' action type. Note: Can only be used when 'table' field is specified.

    filterCondition?: string

    Encoded query string to filter which records this action applies to

    from?: string | Record<"sys_user">

    Restrict this action to emails from a specific user. Accepts a GUID string or a Record object.

    name?: string

    Name of the inbound email action

    order?: number

    Execution order when multiple inbound actions match. Default: 100

    protectionPolicy?: "read" | "protected"

    Controls edit/view access for other developers after the application is installed.

    • read: Others can see the script logic but not change it.
    • protected: Others cannot change this record.
    • Omit to allow other developers to customize this record.
    replyEmail?: string

    HTML content for auto-reply emails sent back to the sender. Only available for 'reply_email' action type.

    requiredRoles?: (string | Role)[]

    List of roles the sender must have for this action to trigger

    script?: string | ((...args: unknown[]) => void)

    Script executed when the action triggers. Five objects are available in this script:

    • current: a GlideRecord — the target record being created or updated
    • event: a GlideRecord — the sysevent record
    • email: an EmailWrapper — the inbound email
    • logger: a ScopedEmailLogger — for logging email processing activity
    • classifier: an EmailClassifier — for classifying the email

    Consider using Now.include() to move the script to a separate .js file or using a function exported from your src/server modules.

    stopProcessing?: boolean

    When true, stops processing subsequent inbound email actions after this one executes. Default: false

    table?: T

    Target table the action operates on (e.g., 'incident', 'sc_req_item')

    type?: "new" | "reply" | "forward"

    When to trigger: on new emails, replies, or forwards. Default: 'new'