Service Level Agreement API - ServiceNow Fluent
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.
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.
| 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: |
| 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:
Default: SLA |
| active | Boolean | Flag that indicates whether the SLA definition is active and can be matched against task records. Valid values:
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:
|
| 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: |
| 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:
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 |
| scheduleSource | String | The source from which the schedule is
obtained. Valid values:
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
|
| 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: |
| advancedConditionType | String | The type of advanced condition logic to
apply. Valid values:
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:
Default: cancel |
| whenTo | Object | Settings that control when a
paused SLA resumes and when an SLA cancels.
Format: |
| retroactive | Object | Settings that
control whether the SLA start time is set to a point in the past based on a specified field value.
Format: |
| timezoneSource | String | The source from which the time zone
for SLA calculations is obtained. Valid values:
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 |
| 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:
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. Valid values for installMethod:
|
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',
})