@servicenow/sdk - v4.13.3
    Preparing search index...
    • Creates an activity definition metadata object.

      The build plugin matches on ActivityDefinition(...) call expressions and resolves sys_ids by traversing the flow/action and activityType references.

      Type safety is inferred from the backing flow/action inputs and activity type experience properties, filtered by inputDisplayPreferences/experienceDisplayPreferences. When inputDisplayPreferences is omitted, all inputs from the backing flow are exposed.

      Set publicAccess: true only when the platform's sys_pd_activity_definition.public_access is enabled for this definition. It is the definition's declaration that it is safe to run in a publicly accessible playbook; playbooks with publicAccess: true reject any activity whose definition omits it. Defaults to false, matching the platform default.

      Requires the Process Automation Designer (sn_pa_designer) store app at version 29.0.0 or later (the Australia release) — sys_pd_activity_definition.public_access doesn't exist on earlier versions; the SDK doesn't validate the installed version.

      Type Parameters

      • const Flow extends BackingDef
      • const Type extends ActivityTypeDef | undefined = undefined
      • const InputDisplay extends Record<string, DisplayLevel> | undefined = undefined
      • const ExperienceDisplay extends Record<string, DisplayLevel> | undefined = undefined
      • const TEnableAi extends "on" | "off" = "off"
      • const TAiFieldDisplay extends Record<string, DisplayLevel> | undefined = undefined
      • const PublicAccess extends boolean | undefined = undefined

      Parameters

      • config: {
            $id: string | number | ExplicitKey<string>;
            action?: undefined;
            activityType?: Type;
            aiAgentExecutionMode?: string;
            aiAgentFieldDisplayPreferences?: TAiFieldDisplay;
            aiAgentObjAdditionalDetail?: string;
            aiAgentObjective?: string;
            aiAgentRunAs?: AiAgentRunAs;
            aiAgentRunWithRoles?: (string | Record<"sys_user_role">)[];
            aiAgentSupportedActions?: AiAgentSupportedAction[];
            aiAgentUser?: string;
            conversationalAgents?: (string | Record<"sn_aia_agent">)[];
            defaultExperienceProperties?: { [K in string]?: any };
            defaultInputs?: { [K in string]?: any };
            enableAiAgent?: TEnableAi;
            experienceDisplayPreferences?: ExperienceDisplay;
            flow: Flow;
            inputDisplayPreferences?: InputDisplay;
            label: string;
            launchAgentWhenActivityStart?: boolean;
            publicAccess?: PublicAccess;
        }
        • $id: string | number | ExplicitKey<string>
        • Optionalaction?: undefined
        • OptionalactivityType?: Type
        • OptionalaiAgentExecutionMode?: string

          Enables Autonomous mode for activity instances built from this definition. aiAgentExecutionMode: 'on' here is what makes aiAgentExecutionMode: 'on' legal on an instance — if this is omitted, instances built from this definition are restricted to Collaborative mode ('off'); setting Autonomous mode on such an instance is a build error.

        • OptionalaiAgentFieldDisplayPreferences?: TAiFieldDisplay

          Restricts which AI-agent fields activity instances built from this definition may set, mirroring inputDisplayPreferences/experienceDisplayPreferences. If enableAiAgent is 'on' but this is omitted, all AI-agent fields are exposed; otherwise only the fields listed here are — setting any other AI-agent field on an instance is a TypeScript error, even though the definition otherwise supports AI agents. Unlike inputDisplayPreferences, this isn't an all-or-nothing gate on defaults: a field excluded here can still receive this definition's own default value above even though instances can't set it explicitly.

        • OptionalaiAgentObjAdditionalDetail?: string

          Default aiAgentObjAdditionalDetail inherited by instances that omit the field entirely. See aiAgentObjective for inheritance rules.

        • OptionalaiAgentObjective?: string

          Default aiAgentObjective inherited by instances that omit the field entirely. An explicit value on the instance — including an explicit empty string — always takes priority over this default; only omitting the field inherits it.

        • OptionalaiAgentRunAs?: AiAgentRunAs

          Default aiAgentRunAs inherited by instances that omit the field entirely. See aiAgentObjective for inheritance rules.

        • OptionalaiAgentRunWithRoles?: (string | Record<"sys_user_role">)[]

          Default aiAgentRunWithRoles inherited by instances that omit the field entirely. See aiAgentObjective for inheritance rules.

        • OptionalaiAgentSupportedActions?: AiAgentSupportedAction[]

          Default aiAgentSupportedActions inherited by instances that omit the field entirely. See aiAgentObjective for inheritance rules.

        • Optional InternalaiAgentUser?: string

          Default aiAgentUser inherited by instances that omit the field entirely.

        • OptionalconversationalAgents?: (string | Record<"sn_aia_agent">)[]

          Default conversationalAgents inherited by instances that omit the field entirely. See aiAgentObjective for inheritance rules.

        • OptionaldefaultExperienceProperties?: { [K in string]?: any }
        • OptionaldefaultInputs?: { [K in string]?: any }
        • OptionalenableAiAgent?: TEnableAi

          Turns AI agent support on/off for activity instances built from this definition. enableAiAgent: 'on' is what exposes any AI-agent fields on ActivityConfig at all — if omitted (default 'off'), setting any AI-agent field on an instance built from this definition is a TypeScript error. See "AI Agent Configuration" in playbook-activities-guide.

        • OptionalexperienceDisplayPreferences?: ExperienceDisplay
        • flow: Flow
        • OptionalinputDisplayPreferences?: InputDisplay
        • label: string
        • Optional InternallaunchAgentWhenActivityStart?: boolean

          Whether the AI agent auto-launches as soon as an instance's activity starts.

        • OptionalpublicAccess?: PublicAccess

      Returns InferredActivityDef<
          Flow,
          Type,
          InputDisplay,
          ExperienceDisplay,
          TEnableAi,
          TAiFieldDisplay,
          PublicAccess,
      >

      const MyDef = ActivityDefinition({
      $id: Now.ID['my-def'],
      flow: MyCustomFlow,
      activityType: MyCustomType,
      inputDisplayPreferences: {
      message: 'all',
      priority: 'advanced',
      },
      })
    • Creates an activity definition metadata object.

      The build plugin matches on ActivityDefinition(...) call expressions and resolves sys_ids by traversing the flow/action and activityType references.

      Type safety is inferred from the backing flow/action inputs and activity type experience properties, filtered by inputDisplayPreferences/experienceDisplayPreferences. When inputDisplayPreferences is omitted, all inputs from the backing flow are exposed.

      Set publicAccess: true only when the platform's sys_pd_activity_definition.public_access is enabled for this definition. It is the definition's declaration that it is safe to run in a publicly accessible playbook; playbooks with publicAccess: true reject any activity whose definition omits it. Defaults to false, matching the platform default.

      Requires the Process Automation Designer (sn_pa_designer) store app at version 29.0.0 or later (the Australia release) — sys_pd_activity_definition.public_access doesn't exist on earlier versions; the SDK doesn't validate the installed version.

      Type Parameters

      • const Action extends BackingDef
      • const Type extends ActivityTypeDef | undefined = undefined
      • const InputDisplay extends Record<string, DisplayLevel> | undefined = undefined
      • const ExperienceDisplay extends Record<string, DisplayLevel> | undefined = undefined
      • const TEnableAi extends "on" | "off" = "off"
      • const TAiFieldDisplay extends Record<string, DisplayLevel> | undefined = undefined
      • const PublicAccess extends boolean | undefined = undefined

      Parameters

      • config: {
            $id: string | number | ExplicitKey<string>;
            action: Action;
            activityType?: Type;
            aiAgentExecutionMode?: string;
            aiAgentFieldDisplayPreferences?: TAiFieldDisplay;
            aiAgentObjAdditionalDetail?: string;
            aiAgentObjective?: string;
            aiAgentRunAs?: AiAgentRunAs;
            aiAgentRunWithRoles?: (string | Record<"sys_user_role">)[];
            aiAgentSupportedActions?: AiAgentSupportedAction[];
            aiAgentUser?: string;
            conversationalAgents?: (string | Record<"sn_aia_agent">)[];
            defaultExperienceProperties?: { [K in string]?: any };
            defaultInputs?: { [K in string]?: any };
            enableAiAgent?: TEnableAi;
            experienceDisplayPreferences?: ExperienceDisplay;
            flow?: undefined;
            inputDisplayPreferences?: InputDisplay;
            label: string;
            launchAgentWhenActivityStart?: boolean;
            publicAccess?: PublicAccess;
        }
        • $id: string | number | ExplicitKey<string>
        • action: Action
        • OptionalactivityType?: Type
        • OptionalaiAgentExecutionMode?: string

          Enables Autonomous mode for activity instances built from this definition. aiAgentExecutionMode: 'on' here is what makes aiAgentExecutionMode: 'on' legal on an instance — if this is omitted, instances built from this definition are restricted to Collaborative mode ('off'); setting Autonomous mode on such an instance is a build error.

        • OptionalaiAgentFieldDisplayPreferences?: TAiFieldDisplay

          Restricts which AI-agent fields activity instances built from this definition may set, mirroring inputDisplayPreferences/experienceDisplayPreferences. If enableAiAgent is 'on' but this is omitted, all AI-agent fields are exposed; otherwise only the fields listed here are — setting any other AI-agent field on an instance is a TypeScript error, even though the definition otherwise supports AI agents. Unlike inputDisplayPreferences, this isn't an all-or-nothing gate on defaults: a field excluded here can still receive this definition's own default value above even though instances can't set it explicitly.

        • OptionalaiAgentObjAdditionalDetail?: string

          Default aiAgentObjAdditionalDetail inherited by instances that omit the field entirely. See aiAgentObjective for inheritance rules.

        • OptionalaiAgentObjective?: string

          Default aiAgentObjective inherited by instances that omit the field entirely. An explicit value on the instance — including an explicit empty string — always takes priority over this default; only omitting the field inherits it.

        • OptionalaiAgentRunAs?: AiAgentRunAs

          Default aiAgentRunAs inherited by instances that omit the field entirely. See aiAgentObjective for inheritance rules.

        • OptionalaiAgentRunWithRoles?: (string | Record<"sys_user_role">)[]

          Default aiAgentRunWithRoles inherited by instances that omit the field entirely. See aiAgentObjective for inheritance rules.

        • OptionalaiAgentSupportedActions?: AiAgentSupportedAction[]

          Default aiAgentSupportedActions inherited by instances that omit the field entirely. See aiAgentObjective for inheritance rules.

        • Optional InternalaiAgentUser?: string

          Default aiAgentUser inherited by instances that omit the field entirely.

        • OptionalconversationalAgents?: (string | Record<"sn_aia_agent">)[]

          Default conversationalAgents inherited by instances that omit the field entirely. See aiAgentObjective for inheritance rules.

        • OptionaldefaultExperienceProperties?: { [K in string]?: any }
        • OptionaldefaultInputs?: { [K in string]?: any }
        • OptionalenableAiAgent?: TEnableAi

          Turns AI agent support on/off for activity instances built from this definition. enableAiAgent: 'on' is what exposes any AI-agent fields on ActivityConfig at all — if omitted (default 'off'), setting any AI-agent field on an instance built from this definition is a TypeScript error. See "AI Agent Configuration" in playbook-activities-guide.

        • OptionalexperienceDisplayPreferences?: ExperienceDisplay
        • Optionalflow?: undefined
        • OptionalinputDisplayPreferences?: InputDisplay
        • label: string
        • Optional InternallaunchAgentWhenActivityStart?: boolean

          Whether the AI agent auto-launches as soon as an instance's activity starts.

        • OptionalpublicAccess?: PublicAccess

      Returns InferredActivityDef<
          Action,
          Type,
          InputDisplay,
          ExperienceDisplay,
          TEnableAi,
          TAiFieldDisplay,
          PublicAccess,
      >

      const MyDef = ActivityDefinition({
      $id: Now.ID['my-def'],
      flow: MyCustomFlow,
      activityType: MyCustomType,
      inputDisplayPreferences: {
      message: 'all',
      priority: 'advanced',
      },
      })
    • Creates an activity definition metadata object.

      The build plugin matches on ActivityDefinition(...) call expressions and resolves sys_ids by traversing the flow/action and activityType references.

      Type safety is inferred from the backing flow/action inputs and activity type experience properties, filtered by inputDisplayPreferences/experienceDisplayPreferences. When inputDisplayPreferences is omitted, all inputs from the backing flow are exposed.

      Set publicAccess: true only when the platform's sys_pd_activity_definition.public_access is enabled for this definition. It is the definition's declaration that it is safe to run in a publicly accessible playbook; playbooks with publicAccess: true reject any activity whose definition omits it. Defaults to false, matching the platform default.

      Requires the Process Automation Designer (sn_pa_designer) store app at version 29.0.0 or later (the Australia release) — sys_pd_activity_definition.public_access doesn't exist on earlier versions; the SDK doesn't validate the installed version.

      Type Parameters

      • const Type extends ActivityTypeDef | undefined = undefined
      • const TEnableAi extends "on" | "off" = "off"
      • const TAiFieldDisplay extends Record<string, DisplayLevel> | undefined = undefined
      • const PublicAccess extends boolean | undefined = undefined

      Parameters

      • config: {
            $id: string | number | ExplicitKey<string>;
            activityType?: Type;
            aiAgentExecutionMode?: "on" | "off";
            aiAgentFieldDisplayPreferences?: TAiFieldDisplay;
            aiAgentObjAdditionalDetail?: string;
            aiAgentObjective?: string;
            aiAgentRunAs?: AiAgentRunAs;
            aiAgentRunWithRoles?: (string | Record<"sys_user_role">)[];
            aiAgentSupportedActions?: AiAgentSupportedAction[];
            aiAgentUser?: string;
            conversationalAgents?: (string | Record<"sn_aia_agent">)[];
            defaultExperienceProperties?: { [K in string]?: any };
            enableAiAgent?: TEnableAi;
            label: string;
            launchAgentWhenActivityStart?: boolean;
            publicAccess?: PublicAccess;
        }
        • $id: string | number | ExplicitKey<string>
        • OptionalactivityType?: Type
        • OptionalaiAgentExecutionMode?: "on" | "off"

          Enables Autonomous mode for activity instances built from this definition. aiAgentExecutionMode: 'on' here is what makes aiAgentExecutionMode: 'on' legal on an instance — if this is omitted, instances built from this definition are restricted to Collaborative mode ('off'); setting Autonomous mode on such an instance is a build error.

        • OptionalaiAgentFieldDisplayPreferences?: TAiFieldDisplay

          Restricts which AI-agent fields activity instances built from this definition may set, mirroring inputDisplayPreferences/experienceDisplayPreferences. If enableAiAgent is 'on' but this is omitted, all AI-agent fields are exposed; otherwise only the fields listed here are — setting any other AI-agent field on an instance is a TypeScript error, even though the definition otherwise supports AI agents. Unlike inputDisplayPreferences, this isn't an all-or-nothing gate on defaults: a field excluded here can still receive this definition's own default value above even though instances can't set it explicitly.

        • OptionalaiAgentObjAdditionalDetail?: string

          Default aiAgentObjAdditionalDetail inherited by instances that omit the field entirely. See aiAgentObjective for inheritance rules.

        • OptionalaiAgentObjective?: string

          Default aiAgentObjective inherited by instances that omit the field entirely. An explicit value on the instance — including an explicit empty string — always takes priority over this default; only omitting the field inherits it.

        • OptionalaiAgentRunAs?: AiAgentRunAs

          Default aiAgentRunAs inherited by instances that omit the field entirely. See aiAgentObjective for inheritance rules.

        • OptionalaiAgentRunWithRoles?: (string | Record<"sys_user_role">)[]

          Default aiAgentRunWithRoles inherited by instances that omit the field entirely. See aiAgentObjective for inheritance rules.

        • OptionalaiAgentSupportedActions?: AiAgentSupportedAction[]

          Default aiAgentSupportedActions inherited by instances that omit the field entirely. See aiAgentObjective for inheritance rules.

        • Optional InternalaiAgentUser?: string

          Default aiAgentUser inherited by instances that omit the field entirely.

        • OptionalconversationalAgents?: (string | Record<"sn_aia_agent">)[]

          Default conversationalAgents inherited by instances that omit the field entirely. See aiAgentObjective for inheritance rules.

        • OptionaldefaultExperienceProperties?: { [K in string]?: any }
        • OptionalenableAiAgent?: TEnableAi

          Turns AI agent support on/off for activity instances built from this definition. enableAiAgent: 'on' is what exposes any AI-agent fields on ActivityConfig at all — if omitted (default 'off'), setting any AI-agent field on an instance built from this definition is a TypeScript error. See "AI Agent Configuration" in playbook-activities-guide.

        • label: string
        • Optional InternallaunchAgentWhenActivityStart?: boolean

          Whether the AI agent auto-launches as soon as an instance's activity starts.

        • OptionalpublicAccess?: PublicAccess

      Returns InferredActivityDef<
          undefined,
          Type,
          undefined,
          undefined,
          TEnableAi,
          TAiFieldDisplay,
          PublicAccess,
      >

      const MyDef = ActivityDefinition({
      $id: Now.ID['my-def'],
      flow: MyCustomFlow,
      activityType: MyCustomType,
      inputDisplayPreferences: {
      message: 'all',
      priority: 'advanced',
      },
      })