Service Level Agreement API - ServiceNow Fluent

  • Release version: Australia
  • Updated March 12, 2026
  • 7 minutes to read
  • The Service Level Agreement API defines service level agreements [contract_sla] that set the amount of time for a task to reach a specified condition, ensuring that tasks are resolved according to the service levels agreed between a service provider and customer.

    Note:
    For the latest ServiceNow Fluent API documentation and examples, see the ServiceNow Fluent API reference and ServiceNow SDK examples repository on GitHub.

    For general information about SLAs, see Service Level Management.

    Sla object

    Create an SLA definition [contract_sla] that controls the timing, conditions, workflows, and other information required to create and progress task SLAs.

    Table 1. Properties
    Name Type Description
    $id String or Number Required. A unique ID for the metadata object. When you build the application, this ID is hashed into a unique sys_id. For more information, see ServiceNow Fluent language constructs.

    Format: Now.ID['String' or Number]

    name String Required. A name for the SLA definition.
    table String The name of the table to which the SLA applies.

    Default: incident

    type String The type of service level agreement. The type is used for reporting purposes only.
    Valid values:
    • SLA: A service level agreement between a service provider and an external customer.
    • OLA: An operational level agreement between internal teams within the same organization.
    • Underpinning contract: A contract with an external vendor that underpins the service delivered to the customer.

    Default: SLA

    active Boolean Flag that indicates whether the SLA definition is active and can be matched against task records.
    Valid values:
    • true: The SLA definition is active.
    • false: The SLA definition is inactive and isn’t matched against task records.

    Default: true

    target String The stage of the task that the SLA measures. The target is used for filtering, searching, and reporting purposes only.
    Valid values:
    • response: The SLA measures the time to first respond to a task.
    • resolution: The SLA measures the time to resolve a task.
    duration Object The time duration within which the task must reach the target condition. Use the Duration() function to specify the duration.

    This property is required if the value of the durationType property is empty.

    Format:
    duration: Duration({ days: Number, hours: Number, minutes: Number, seconds: Number })
    durationType Reference or String The sys_id of a relative duration [cmn_relative_duration], such as Breach on Due Date or End of next business day, to use instead of a user-specified duration. To define a relative duration, use the Record API - ServiceNow Fluent.
    relativeDurationWorksOn String The record type from which the relative duration is calculated.

    This property only applies if the value of the durationType property is set.

    Valid values:
    • Task record: The relative duration is calculated from the task record.
    • SLA record: The relative duration is calculated from the SLA record.

    Default: Task record

    schedule Reference or String The sys_id of a schedule [cmn_schedule] for the time periods during which the SLAs accumulate business time. To define a schedule, use the Record API - ServiceNow Fluent.

    This property is required if the value of the scheduleSource property is sla_definition.

    scheduleSource String The source from which the schedule is obtained.
    Valid values:
    • sla_definition: The schedule is specified in the SLA definition using the schedule property.
    • task_field: The schedule is obtained from a field on the task record specified with the scheduleSourceField property.
    • no_schedule: No schedule is used, and the SLA runs continuously (24x7).

    Default: sla_definition

    scheduleSourceField String The field from the task that provides the schedule.

    This property is required if the value of the scheduleSource property is task_field.

    conditions Object Encoded query conditions that control the timing of an SLA. For example, 'priority=1^state!=6' matches tasks with a priority of 1 that aren’t in a closed state.

    For more information about SLA conditions, see Create an SLA definition. For information about filter queries, see Operators available for filters and queries.

    Format:
    conditions: {
      start: 'String',
      stop: 'String',
      pause: 'String',
      resume: 'String',
      reset: 'String',
      cancel: 'String',
    }
    advancedConditionType String The type of advanced condition logic to apply.
    Valid values:
    • none: No advanced condition logic is applied.
    • advanced: A custom advanced condition script is used.
    • advanced_journal: Advanced condition logic based on journal entries is used.
    • advanced_system: Advanced condition logic based on system events is used.
    • advanced_journal_and_system: Advanced condition logic based on both journal entries and system events is used.

    Default: none

    conditionType String The sys_id of an SLA condition [sla_condition_class] that determines when transitions between different stages of each task SLA.
    resetAction String The action to take on the current task SLA record when the reset condition is met.
    Valid values:
    • cancel: The current task SLA record is canceled and a new one is created.
    • complete: The current task SLA record is marked as complete and a new one is created.

    Default: cancel

    whenTo Object Settings that control when a paused SLA resumes and when an SLA cancels.
    • resume: The behavior that controls when a paused SLA resumes timing.
      Valid values:
      • on_condition: The SLA resumes when the task record matches the condition defined with the resume property of the conditions object.
      • no_match: The SLA resumes when the task record no longer matches the pause condition defined with the pause property of the conditions object.

      Default: on_condition

    • cancel: The behavior that controls when an active SLA is canceled.
      Valid values:
      • on_condition: The SLA is canceled when the task record matches the condition defined with the cancel property of the conditions object.
      • no_match: The SLA is canceled when the task record no longer matches the start condition defined with the start property of the conditions object.
      • never: The SLA is never canceled regardless of task record state.

      Default: on_condition

    Format:
    whenTo: {
      resume: 'String',
      cancel: 'String',
    }
    retroactive Object Settings that control whether the SLA start time is set to a point in the past based on a specified field value.
    • start: Flag that indicates whether retroactive start is enabled. When enabled, the SLA start time is set to the value of the field specified in setStartTo rather than the time when the start condition was first met.

      Default: false

    • setStartTo: The field on the task record whose value is used as the SLA start time when retroactive start is enabled. This property is required if the value of the start property is true.
    • pause: Flag that indicates whether retroactive pause is enabled when retroactive start is active. When enabled, any time that the task was in a paused state before the SLA was attached is subtracted from the elapsed time.

      Default: true

    Format:
    retroactive: {
      start: Boolean,
      setStartTo: 'String',
      pause: Boolean,
    }
    timezoneSource String The source from which the time zone for SLA calculations is obtained.
    Valid values:
    • task.caller_id.time_zone: The time zone of the caller on the task record.
    • task.caller_id.location.time_zone: The time zone of the caller's location on the task record.
    • task.cmdb_ci.location.time_zone: The time zone of the configuration item's location on the task record.
    • task.location.time_zone: The time zone of the location on the task record.
    • sla.timezone: The time zone specified with the timezone property.

    Default: task.caller_id.time_zone

    timezone String The time zone to use for SLA calculations, such as US/Pacific.

    This property is required if the value of the timezoneSource property is sla.timezone.

    overrides Reference or String The variable identifier or sys_id of another SLA definition [contract_sla] that this SLA definition overrides.
    workflow Reference or String The variable identifier or sys_id of a workflow [wf_workflow] to run when the SLA reaches a milestone or breaches. To define a workflow, use the Record API - ServiceNow Fluent.
    flow Reference or String The variable identifier or sys_id of a flow [sys_hub_flow] to run when the SLA reaches a milestone or breaches. To define a flow, use the Flow API - ServiceNow Fluent.

    Default: Default SLA flow (828f267973333300e289235f04f6a7a3)

    vendor Reference or String The variable identifier or sys_id of a company [core_company] that is the vendor for an underpinning contract SLA. To define a company, use the Record API - ServiceNow Fluent.
    domainPath String The domain path that determines which domain owns the SLA in a multi-domain environment.

    Default: The global domain (/)

    enableLogging Boolean Flag that indicates whether debug logging is enabled for the SLA definition.
    Valid values:
    • true: Debug logging is enabled.
    • false: Debug logging is turned off.

    Default: false

    $meta Object Metadata for the application metadata.
    With the installMethod property, you can map the application metadata to an output directory that loads only in specific circumstances.
    $meta: {
          installMethod: 'String'
    }
    Valid values for installMethod:
    • demo: Outputs the application metadata to the metadata/unload.demo directory to be installed with the application when the Load demo data option is selected.
    • first install: Outputs the application metadata to the metadata/unload directory to be installed only the first time an application is installed on an instance.
    import { Sla, Duration } from '@servicenow/sdk/core'
    
    Sla({
        $id: Now.ID['incident-p1-resolution'],
        name: 'P1 Incident Resolution',
        table: 'incident',
        target: 'resolution',
        duration: Duration({ hours: 4 }),
        schedule: 'b1992362eb601100fcfb858ad106fe16',
        conditions: {
            start: 'priority=1',
            stop: 'state=6',
            pause: 'state=3',
            resume: 'state!=3',
        },
        whenTo: {
            resume: 'on_condition',
        },
        resetAction: 'cancel',
    })