OnCallRotation - Global
-
- UpdatedAug 3, 2023
- 15 minutes to read
- Vancouver
- API reference
Use to manage on-call schedules.
For information, see On-call scheduling
OnCallRotation - getCatchAll(String rotaID)
Gets the sys_id of the catch all person. Use together with the getCatchAllType() method to determine the source of the returned id. This API is applicable for a single shift, overlapping shifts, and custom escalation.
Name | Type | Description |
---|---|---|
rotaID | String | The sys_id of the rota. |
Type | Description |
---|---|
String | The sys_id of a sys_user, a cmn_rota_roster, or null. |
Example
Output:
OnCallRotation - getCatchAllType(String rotaID)
Gets the type of _catch all_ that lives at the end of the escalation chain. When the escalation chain finishes without assigning an on-call person, if configured, the incident is assigned to the _catch all_. This API is applicable for a single shift, overlapping shifts, and custom escalation.
Name | Type | Description |
---|---|---|
rotaID | String | The sys_id of the rota. |
Type | Description |
---|---|
String |
|
Example
Output:
OnCallRotation - getEscalatees(String groupSysIds, String rotaSysIds, String rosterSysIds, GlideDateTime gdt, GlideRecord taskGr)
Gets a list of escalatees that are on-call for a given time. If no time is specified, then the current time is used. If no groupSysIds are provided, empty list is returned. This API is applicable for a single shift, overlapping shifts, and custom escalation.
Type | Description |
---|---|
Object | Escalatee information such as userIds, deviceIds, and escalationGroups. |
Example
Output:
For single shift:
For overlapping shift:
For custom escalation
Example
OnCallRotation - getEscalateeAt(String groupID, GlideDateTime dateTime, Number position)
Gets an item to escalate to, either a user [sys_user], group, or notification device [cmn_notif_device], for a group's shift at the specified date and time and at a certain position in the escalation lineup. This API is applicable for a single shift.
The method returns null if an invalid position or group is passed as an argument.
You can use the getTableName() method to check whether the returning GlideRecord comes from the sys_user or cmn_notif_device table.
Name | Type | Description |
---|---|---|
groupID | String | The sys_id for the group from which to get the item to escalate. |
dateTime | GlideDateTime | The date and time when the escalation lineup should begin. |
position | Number | The position in the lineup to determine the item to escalate to (1-based, which means the count starts with 1). |
Type | Description |
---|---|
GlideRecord | The item to escalate to,that is, escalatees (either a user, group, or device records depending on the notification rules) at a specific time and position. Returns null if nothing is found. |
Example
Output:
OnCallRotation - getEscalationPlan(String groupSysId, GlideDateTime gdt, String rotaSysIds, GlideRecord taskGr)
Gets a list of objects to escalate to, escalation plans that consist of either a user [sys_user] or notification device [cmn_notif_device], for a group's shift at the specified date and time. This API is applicable for a single shift, overlapping shifts, and custom escalation.
- Number order: the escalation order within the lineup
- String userId: sys_id of the sys_user record or null
- String deviceId: sys_id of the cmn_notif_device record or null
- Boolean isDevice: true or false depending on whether the item to escalate to is a device or user
- GlideDuration timeBetweenReminders: the time between reminders being sent
- Number reminderNum: number of reminders to be sent for each item to escalate to
Type | Description |
---|---|
Object | A list of escalation objects to escalate to. |
Example
Output:
For single shift:
For overlapping shift:
For custom escalation:
Example
OnCallRotation - getEscalationType(String rotaID)
Gets the type of escalation based on a simple calculation. If there is one active roster in the rota, rotate through members. If there is more than one active roster in the rota, rotate through rosters. This API is applicable for a single shift, overlapping shifts, and custom escalation.
Name | Type | Description |
---|---|---|
rotaID | String | The sys_id for the rota to check for rosters. |
Type | Description |
---|---|
String |
|
Example
Output:
OnCallRotation - OnCallRotation()
Creates an instance of the OnCallRotation class.
Name | Type | Description |
---|---|---|
None |
Example
OnCallRotation - spansOverlap(ArrayList parent, ArrayList child, String timeZone)
Checks if the parent span and child spans overlap.
Name | Type | Description |
---|---|---|
parent | ArrayList | The parent spans to compare. |
child | ArrayList | The child spans to compare. |
timeZone | String | The name of the time zone. |
Type | Description |
---|---|
Boolean | Returns true if the parent and child spans overlap. |
Example
OnCallRotation - getEscalateesAt(String groupSysId, GlideDateTime gdt, Number position, GlideRecord taskGr)
Gets the escalatees (either a user, group, or device records depending on the notification rules) at a specific time and position. This API is applicable for a single shift, overlapping shifts and custom escalation.
Type | Description |
---|---|
GlideRecord | Array of escalatees (either a user, group, or device records depending on the notification rules) at a specific time and position. |
Example
Output:
For overlapping shifts:
For custom escalation:
Example
OnCallRotation - getPrimaryUser()
Gets the sys_id of the current primary contact when there is a single shift.
Name | Type | Description |
---|---|---|
None |
Type | Description |
---|---|
String | sys_id of the current primary contact. |
Example
Example:
Output:
OnCallRotation - getPrimaryUserByRota(String rotaId)
Gets the sys_id of the current primary user of the specified shift. This API is applicable for a single shift and overlapping shifts.
Name | Type | Description |
---|---|---|
rotaId | String | sys_id of the cmn_rota. |
Type | Description |
---|---|
String | sys_id of the current primary user of the specified shift. |
Example
Output:
OnCallRotation - getPrimaryUserName()
Gets the name of the current primary contact. This API is applicable for a single shift.
Name | Type | Description |
---|---|---|
None |
Type | Description |
---|---|
String | Name of the current primary contact. |
Example
Output:
OnCallRotation - getPrimaryUserNameByRota(String rotaId)
Gets the name of the current primary user of the specified shift. This API is applicable for a single shift and overlapping shifts.
Name | Type | Description |
---|---|---|
rotaId | String | sys_id of the cmn_rota. |
Type | Description |
---|---|
String | Name of the current primary user of the specified shift. |
Example
Output:
OnCallRotation - getPrimaryUsers()
Gets the list of primary contacts for a shift. This API is applicable for a single shift, overlapping shifts, and custom escalation.
Name | Type | Description |
---|---|---|
None |
Type | Description |
---|---|
Object | List of primary contacts. |
Example
Output:
OnCallRotation - whoIsOnCall(String groupSysIds, String rotaSysIds, String rosterSysIds, GlideDateTime gdt)
Gets the list of users that are on-call at a given time. If no time is specified, then current time is used. This API is applicable for a single shift and overlapping shifts.
Type | Description |
---|---|
Object | List of users, groups, or devices that are on-call at a given time. For example, information about userIds, deviceIds, and escalationGroups. |
Example
Output:
For single shift:
For overlapping shift:
OnCallRotation - who(String groupSysId, GlideDateTime gdt, Boolean nullifyOverrideRoster, String rotaSysIds, Boolean overrideCustomEscalation, GlideRecord taskGR)
Specifies if there is an on-call user, group, or device. This method is applicable for a single shift, overlapping shifts, and custom escalation.
Type | Description |
---|---|
Boolean | Flag that indicates whether a match was found. Possible values:
|
Example
Output:
Example
The following example shows how to create a custom escalation for service desk shift with condition P1 for an incident.
Output:
OnCallRotation - whoAt(String groupSysId, GlideDateTime gdt, String rotaSysIds)
Specifies if there is an on-call user, group, or device. This API is applicable for a single shift, overlapping shifts, and custom escalation.
Name | Type | Description |
---|---|---|
groupSysId | String | Sys ID of the group. |
gdt | GlideDateTime | yyyy-MM-dd HH:mm:ss format in the UTC timezone. Default is now. |
rotaSysIds | String | Comma-separated list of cmn_rota Sys IDs to filter the records by. |
Type | Description |
---|---|
Boolean | True if there is at least one on-call user, group, or device; false otherwise. |
Example
Output:
OnCallRotation - startEscalations(GlideRecord now_GR, String eventName, String escalationScriptName)
Start the escalations for a document(incident now_GR) and group, and specify the event name for the escalation notifications. In addition, specify the name of the business rule to call when an escalation occurs. This method should be used after a succesful call to who or whoAt methods. This API is applicable for a single shift, overlapping shifts, and custom escalation.
Name | Type | Description |
---|---|---|
now_GR | GlideRecord | Document glide record. For example, Incident now_GR. |
eventName | String | Event name for the escalation notifications. |
escalationScriptName | String | Business rule to call when escalation occurs |
Type | Description |
---|---|
void |
OnCallRotation - addCurrentToNotified()
Add the current escalation member to the list of notified users so that the API knows who has been contacted. This API is applicable for a single shift, overlapping shifts, and custom escalation.
Name | Type | Description |
---|---|---|
None |
Type | Description |
---|---|
void |
OnCallRotation - whoIsNext(GlideRecord escalationGr)
Escalation business rules determine who in the shift should be contacted next. The escalation record passed to the method tracks the escalation between invocations of the business rule. This API is applicable for a single shift, overlapping shifts, and custom escalation.
Name | Type | Description |
---|---|---|
escalationGr | GlideRecord | GlideRecord of Rotation escalation [cmn_rota_escalation]. |
Type | Description |
---|---|
None |
OnCallRotation - continueEscalations(GlideRecord escalationGr)
Continue the escalations for a document(incident now_GR) and group. This API is applicable for a single shift, overlapping shifts, and custom escalation.
Name | Type | Description |
---|---|---|
escalationGr | GlideRecord | GlideRecord of Rotation escalation(cmn_rota_escalation |
Type | Description |
---|---|
void |
OnCallRotation - cancelEscalations(GlideRecord escalationGr)
Cancels any escalations for the GlideRecord that were started with the startEscalations API. This API is applicable for a single shift, overlapping shifts, and custom escalation.
Name | Type | Description |
---|---|---|
escalationGr | GlideRecord | GlideRecord of Rotation escalation(cmn_rota_escalation |
Type | Description |
---|---|
void |
On this page
- OnCallRotation - getCatchAll(String rotaID)
- OnCallRotation - getCatchAllType(String rotaID)
- OnCallRotation - getEscalatees(String groupSysIds, String rotaSysIds, String rosterSysIds,
GlideDateTime gdt, GlideRecord taskGr)
- OnCallRotation - getEscalateeAt(String groupID, GlideDateTime dateTime, Number
position)
- OnCallRotation - getEscalationPlan(String groupSysId, GlideDateTime gdt, String rotaSysIds,
GlideRecord taskGr)
- OnCallRotation - getEscalationType(String rotaID)
- OnCallRotation - OnCallRotation()
- OnCallRotation - spansOverlap(ArrayList parent, ArrayList child, String timeZone)
- OnCallRotation - getEscalateesAt(String groupSysId, GlideDateTime gdt, Number position,
GlideRecord taskGr)
- OnCallRotation - getPrimaryUser()
- OnCallRotation - getPrimaryUserByRota(String rotaId)
- OnCallRotation - getPrimaryUserName()
- OnCallRotation - getPrimaryUserNameByRota(String rotaId)
- OnCallRotation - getPrimaryUsers()
- OnCallRotation - whoIsOnCall(String groupSysIds, String rotaSysIds, String rosterSysIds,
GlideDateTime gdt)
- OnCallRotation - who(String groupSysId, GlideDateTime gdt, Boolean nullifyOverrideRoster,
String rotaSysIds, Boolean overrideCustomEscalation, GlideRecord taskGR)
- OnCallRotation - whoAt(String groupSysId, GlideDateTime gdt, String rotaSysIds)
- OnCallRotation - startEscalations(GlideRecord now_GR, String eventName, String
escalationScriptName)
- OnCallRotation - addCurrentToNotified()
- OnCallRotation - whoIsNext(GlideRecord escalationGr)
- OnCallRotation - continueEscalations(GlideRecord escalationGr)
- OnCallRotation - cancelEscalations(GlideRecord escalationGr)