{"revision":"c10276e953456835cdbb1f3a60d58ae1980be353","document":{"id":1084,"path":"api-reference/server-api-reference/c_OnCallRotationAPI.md","title":"OnCallRotation - Global","bundle":null,"doc_type":null,"release":"australia","body":"\n# OnCallRotation- Global\n\nThe OnCallRotation script include provides methods to manage on-call schedules.\n\nFor information, see [On-call scheduling](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/it-service-management/c_OnCallScheduling.md).\n\n**Parent Topic:**[Server API reference](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/api-reference/server-api-reference/api-server.md)\n\n## OnCallRotation - OnCallRotation\\(\\)\n\nCreates an instance of the OnCallRotation class.\n\n|Name|Type|Description|\n|----|----|-----------|\n|None| | |\n\n```\nvar oncall = new OnCallRotation();\n```\n\n## OnCallRotation - addCurrentToNotified\\(\\)\n\nAdd 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.\n\n|Name|Type|Description|\n|----|----|-----------|\n|None| | |\n\n|Type|Description|\n|----|-----------|\n|void| |\n\n## OnCallRotation - cancelEscalations\\(GlideRecord escalationGr\\)\n\nCancels 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.\n\n|Name|Type|Description|\n|----|----|-----------|\n|escalationGr|GlideRecord|GlideRecord of Rotation escalation\\(cmn\\_rota\\_escalation|\n\n|Type|Description|\n|----|-----------|\n|void| |\n\n## OnCallRotation - continueEscalations\\(GlideRecord escalationGr\\)\n\nContinue the escalations for a document\\(incident now\\_GR\\) and group. This API is applicable for a single shift, overlapping shifts, and custom escalation.\n\n|Name|Type|Description|\n|----|----|-----------|\n|escalationGr|GlideRecord|GlideRecord of Rotation escalation\\(cmn\\_rota\\_escalation|\n\n|Type|Description|\n|----|-----------|\n|void| |\n\n## OnCallRotation - getCatchAll\\(String rotaID\\)\n\nGets 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.\n\n|Name|Type|Description|\n|----|----|-----------|\n|rotaID|String|The sys\\_id of the rota.|\n\n|Type|Description|\n|----|-----------|\n|String|The sys\\_id of a sys\\_user, a cmn\\_rota\\_roster, or null.|\n\n```\n\nvar rotaSysId = '349f399173062300e7af6238edf6a75e';\nvar onCallRotation = new OnCallRotation();\nvar catchAll = onCallRotation.getCatchAll(rotaSysId);\ngs.log(catchAll);\n\n```\n\nOutput:\n\n```\n46d44a23a9fe19810012d100cca80666\n```\n\n## OnCallRotation - getCatchAllType\\(String rotaID\\)\n\nGets 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.\n\n|Name|Type|Description|\n|----|----|-----------|\n|rotaID|String|The sys\\_id of the rota.|\n\n<table id=\"table_hsz_g1g_2w\" class=\"returns\"><thead><tr><th>\n\nType\n\n</th><th>\n\nDescription\n\n</th></tr></thead><tbody><tr><td>\n\nString\n\n</td><td>\n\n-   Null: invalid rota id or catch all is not available.\n-   Group\\_manager: the manager of the group linked to the rota is the catch all person.\n-   Individual: a configured user is the catch all person.\n-   All: all members of the configured roster are the catch all person.\n\n</td></tr></tbody>\n</table>```\nvar rotaSysId = '349f399173062300e7af6238edf6a75e';\nvar onCallRotation = new OnCallRotation();\nvar catchAllType = onCallRotation.getCatchAllType(rotaSysId);\ngs.log(catchAllType);\n\n```\n\nOutput:\n\n```\ngroup_manager\n```\n\n## OnCallRotation - getEscalateeAt\\(String groupID, GlideDateTime dateTime, Number position\\)\n\nGets 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.\n\nThe method returns null if an invalid position or group is passed as an argument.\n\nYou can use the getTableName\\(\\) method to check whether the returning GlideRecord comes from the sys\\_user or cmn\\_notif\\_device table.\n\n|Name|Type|Description|\n|----|----|-----------|\n|groupID|String|The sys\\_id for the group from which to get the item to escalate.|\n|dateTime|GlideDateTime|The date and time when the escalation lineup should begin.|\n|position|Number|The position in the lineup to determine the item to escalate to \\(1-based, which means the count starts with 1\\).|\n\n|Type|Description|\n|----|-----------|\n|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.|\n\n```\n\nvar groupSysId = '096fb59173062300e7af6238edf6a783';\nvar currentTime = new GlideDateTime();\nvar onCallRotation = new OnCallRotation();\nvar escalatee = onCallRotation.getEscalateeAt(groupSysId, currentTime, 1);\ngs.log(escalatee.name);\n\n```\n\nOutput:\n\n```\nAbel Tuter\n```\n\n## OnCallRotation - getEscalatees\\(String groupSysIds, String rotaSysIds, String rosterSysIds, GlideDateTime gdt, GlideRecord taskGr\\)\n\nGets 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.\n\n**Note:** Set the taskGR parameter to enable escalation plan evaluation.\n\n|Name|Type|Description|\n|----|----|-----------|\n|groupSysIds|String|Comma-separated list of sys\\_ids of the sys\\_user\\_group, to filter the records by.|\n|rotaSysIds|String|Comma-separated list of cmn\\_rota sys\\_ids to filter the records by.|\n|rosterSysIds|String|Comma-separated list of cmn\\_rota\\_roster sys\\_ids to filter the records by.|\n|gdt|GlideDateTime|Date in the UTC timezone|\n|taskGr|GlideRecord|Optional. Current task record. If taskGr is empty, this method returns the default escalation plan. If taskGr is passed, escalation policies are evaluated in order and this method returns the corresponding escalation plan.|\n\n|Type|Description|\n|----|-----------|\n|Object|Escalatee information such as userIds, deviceIds, and escalationGroups.|\n\n```\n\nvar groupSysId = '096fb59173062300e7af6238edf6a783';\nvar currentTime = new GlideDateTime();\nvar onCallRotation = new OnCallRotation();\nvar result = onCallRotation.getEscalatees(groupSysId, \"\", \"\", currentTime);\ngs.log(JSON.stringify(result));\n\n```\n\nOutput:\n\nFor single shift:\n\n```\n[\n  {\n    \"memberId\": \"119f399173062300e7af6238edf6a7e7\",\n    \"memberIds\": [],\n    \"userId\": \"62826bf03710200044e0bfc8bcbe5df1\",\n    \"userIds\": [],\n    \"roster\": \"9d9f399173062300e7af6238edf6a7e5\",\n    \"rota\": \"349f399173062300e7af6238edf6a75e\",\n    \"group\": \"096fb59173062300e7af6238edf6a783\",\n    \"escalationGroups\": [],\n    \"deviceId\": \"\",\n    \"deviceIds\": [],\n    \"isDevice\": false,\n    \"order\": 1,\n    \"isOverride\": false,\n    \"rotationScheduleId\": \"119f399173062300e7af6238edf6a7df\",\n    \"memberScheduleId\": \"9d9f399173062300e7af6238edf6a7ec\"\n  },\n  {\n    \"memberId\": \"1d9f399173062300e7af6238edf6a7e8\",\n    \"memberIds\": [],\n    \"userId\": \"a8f98bb0eb32010045e1a5115206fe3a\",\n    \"userIds\": [],\n    \"roster\": \"9d9f399173062300e7af6238edf6a7e5\",\n    \"rota\": \"349f399173062300e7af6238edf6a75e\",\n    \"group\": \"096fb59173062300e7af6238edf6a783\",\n    \"escalationGroups\": [],\n    \"deviceId\": \"\",\n    \"deviceIds\": [],\n    \"isDevice\": false,\n    \"order\": 2,\n    \"isOverride\": false,\n    \"rotationScheduleId\": \"119f399173062300e7af6238edf6a7df\",\n    \"memberScheduleId\": \"d99f399173062300e7af6238edf6a7ef\"\n  },\n  {\n    \"memberId\": \"dd9f399173062300e7af6238edf6a7e9\",\n    \"memberIds\": [],\n    \"userId\": \"0a826bf03710200044e0bfc8bcbe5d7a\",\n    \"userIds\": [],\n    \"roster\": \"9d9f399173062300e7af6238edf6a7e5\",\n    \"rota\": \"349f399173062300e7af6238edf6a75e\",\n    \"group\": \"096fb59173062300e7af6238edf6a783\",\n    \"escalationGroups\": [],\n    \"deviceId\": \"\",\n    \"deviceIds\": [],\n    \"isDevice\": false,\n    \"order\": 3,\n    \"isOverride\": false,\n    \"rotationScheduleId\": \"119f399173062300e7af6238edf6a7df\",\n    \"memberScheduleId\": \"519f399173062300e7af6238edf6a7f2\"\n  }\n]\n\n```\n\nFor overlapping shift:\n\n```\n[\n  {\n    \"memberId\": \"119f399173062300e7af6238edf6a7e7\",\n    \"memberIds\": [],\n    \"userId\": \"62826bf03710200044e0bfc8bcbe5df1\",\n    \"userIds\": [],\n    \"roster\": \"9d9f399173062300e7af6238edf6a7e5\",\n    \"rota\": \"349f399173062300e7af6238edf6a75e\",\n    \"group\": \"096fb59173062300e7af6238edf6a783\",\n    \"escalationGroups\": [],\n    \"deviceId\": \"\",\n    \"deviceIds\": [],\n    \"isDevice\": false,\n    \"order\": 1,\n    \"isOverride\": false,\n    \"rotationScheduleId\": \"119f399173062300e7af6238edf6a7df\",\n    \"memberScheduleId\": \"9d9f399173062300e7af6238edf6a7ec\"\n  },\n  {\n    \"memberId\": \"7daf799173062300e7af6238edf6a7a2\",\n    \"memberIds\": [],\n    \"userId\": \"d2826bf03710200044e0bfc8bcbe5dc9\",\n    \"userIds\": [],\n    \"roster\": \"b5af799173062300e7af6238edf6a7a2\",\n    \"rota\": \"35af799173062300e7af6238edf6a79e\",\n    \"group\": \"096fb59173062300e7af6238edf6a783\",\n    \"escalationGroups\": [],\n    \"deviceId\": \"\",\n    \"deviceIds\": [],\n    \"isDevice\": false,\n    \"order\": 1,\n    \"isOverride\": false,\n    \"rotationScheduleId\": \"3daf799173062300e7af6238edf6a79e\",\n    \"memberScheduleId\": \"06af799173062300e7af6238edf6a7cd\"\n  },\n  {\n    \"memberId\": \"1d9f399173062300e7af6238edf6a7e8\",\n    \"memberIds\": [],\n    \"userId\": \"a8f98bb0eb32010045e1a5115206fe3a\",\n    \"userIds\": [],\n    \"roster\": \"9d9f399173062300e7af6238edf6a7e5\",\n    \"rota\": \"349f399173062300e7af6238edf6a75e\",\n    \"group\": \"096fb59173062300e7af6238edf6a783\",\n    \"escalationGroups\": [],\n    \"deviceId\": \"\",\n    \"deviceIds\": [],\n    \"isDevice\": false,\n    \"order\": 2,\n    \"isOverride\": false,\n    \"rotationScheduleId\": \"119f399173062300e7af6238edf6a7df\",\n    \"memberScheduleId\": \"d99f399173062300e7af6238edf6a7ef\"\n  },\n  {\n    \"memberId\": \"f5af799173062300e7af6238edf6a7c9\",\n    \"memberIds\": [],\n    \"userId\": \"ee826bf03710200044e0bfc8bcbe5def\",\n    \"userIds\": [],\n    \"roster\": \"b5af799173062300e7af6238edf6a7a2\",\n    \"rota\": \"35af799173062300e7af6238edf6a79e\",\n    \"group\": \"096fb59173062300e7af6238edf6a783\",\n    \"escalationGroups\": [],\n    \"deviceId\": \"\",\n    \"deviceIds\": [],\n    \"isDevice\": false,\n    \"order\": 2,\n    \"isOverride\": false,\n    \"rotationScheduleId\": \"3daf799173062300e7af6238edf6a79e\",\n    \"memberScheduleId\": \"8aaf799173062300e7af6238edf6a7cf\"\n  },\n  {\n    \"memberId\": \"dd9f399173062300e7af6238edf6a7e9\",\n    \"memberIds\": [],\n    \"userId\": \"0a826bf03710200044e0bfc8bcbe5d7a\",\n    \"userIds\": [],\n    \"roster\": \"9d9f399173062300e7af6238edf6a7e5\",\n    \"rota\": \"349f399173062300e7af6238edf6a75e\",\n    \"group\": \"096fb59173062300e7af6238edf6a783\",\n    \"escalationGroups\": [],\n    \"deviceId\": \"\",\n    \"deviceIds\": [],\n    \"isDevice\": false,\n    \"order\": 3,\n    \"isOverride\": false,\n    \"rotationScheduleId\": \"119f399173062300e7af6238edf6a7df\",\n    \"memberScheduleId\": \"519f399173062300e7af6238edf6a7f2\"\n  },\n  {\n    \"memberId\": \"8aaf799173062300e7af6238edf6a7ca\",\n    \"memberIds\": [],\n    \"userId\": \"e2826bf03710200044e0bfc8bcbe5de0\",\n    \"userIds\": [],\n    \"roster\": \"b5af799173062300e7af6238edf6a7a2\",\n    \"rota\": \"35af799173062300e7af6238edf6a79e\",\n    \"group\": \"096fb59173062300e7af6238edf6a783\",\n    \"escalationGroups\": [],\n    \"deviceId\": \"\",\n    \"deviceIds\": [],\n    \"isDevice\": false,\n    \"order\": 3,\n    \"isOverride\": false,\n    \"rotationScheduleId\": \"3daf799173062300e7af6238edf6a79e\",\n    \"memberScheduleId\": \"02af799173062300e7af6238edf6a7d2\"\n  }\n]\n\n```\n\nFor custom escalation\n\n```\n[\n  {\n    \"memberId\": \"\",\n    \"memberIds\": [],\n    \"userId\": \"\",\n    \"userIds\": [\n      \"62826bf03710200044e0bfc8bcbe5df1\",\n      \"46d44a23a9fe19810012d100cca80666\"\n    ],\n    \"roster\": \"\",\n    \"rota\": \"349f399173062300e7af6238edf6a75e\",\n    \"group\": \"096fb59173062300e7af6238edf6a783\",\n    \"escalationGroups\": [\n      \"a715cd759f2002002920bde8132e7018\"\n    ],\n    \"deviceId\": \"\",\n    \"deviceIds\": [],\n    \"isDevice\": false,\n    \"order\": 1,\n    \"isOverride\": false,\n    \"rotationScheduleId\": \"119f399173062300e7af6238edf6a7df\",\n    \"memberScheduleId\": \"\"\n  },\n  {\n    \"memberId\": \"\",\n    \"memberIds\": [\n      \"119f399173062300e7af6238edf6a7e7\"\n    ],\n    \"userId\": \"\",\n    \"userIds\": [\n      \"62826bf03710200044e0bfc8bcbe5df1\"\n    ],\n    \"roster\": \"9d9f399173062300e7af6238edf6a7e5\",\n    \"rota\": \"349f399173062300e7af6238edf6a75e\",\n    \"group\": \"096fb59173062300e7af6238edf6a783\",\n    \"escalationGroups\": [],\n    \"deviceId\": \"\",\n    \"deviceIds\": [],\n    \"isDevice\": false,\n    \"order\": 2,\n    \"isOverride\": false,\n    \"rotationScheduleId\": \"119f399173062300e7af6238edf6a7df\",\n    \"memberScheduleId\": \"\"\n  }\n]\n\n```\n\n```\n/**\n * create a custom escalation for service desk shift with condition as P1 for Incident\n * taskGr is optional parameter\n * if taskGr is empty then it returns list of escalatees in default escalation plan\n * if taskGr is passed then escalation policies are executed evaluated in order and list of escalatees in corresponding escalation plan is returned\n**/\nvar serviceDeskSysId = 'd625dccec0a8016700a222a0f7900d06';\nvar taskGr = new GlideRecord('incident');\ntaskGr.get('ed92e8d173d023002728660c4cf6a7bc');\n\nvar ocRotation = new OnCallRotation();\nvar escalatees = ocRotation.getEscalatees(serviceDeskSysId, null, null, null, null, taskGr);\ngs.log(JSON.stringify(escalatees));\n```\n\n## OnCallRotation - getEscalationPlan\\(String groupSysId, GlideDateTime gdt, String rotaSysIds, GlideRecord taskGr\\)\n\nGets 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.\n\nThe Escalation object contains the following fields:\n\n-   Number order: the escalation order within the lineup\n-   String userId: sys\\_id of the sys\\_user record or null\n-   String deviceId: sys\\_id of the cmn\\_notif\\_device record or null\n-   Boolean isDevice: true or false depending on whether the item to escalate to is a device or user\n-   GlideDuration timeBetweenReminders: the time between reminders being sent\n-   Number reminderNum: number of reminders to be sent for each item to escalate to\n\n**Note:** Set the taskGR parameter to enable escalation plan evaluation.\n\n|Name|Type|Description|\n|----|----|-----------|\n|groupID|String|sys\\_id for the group for which you need the escalation plan.|\n|gdt|GlideDateTime|Date and time when the escalation lineup should begin. Default is now. yyyy-MM-dd HH:mm:ss is the format in UTC timezone.|\n|rotaSysIds|String|Comma-separated list of cmn\\_rota sys\\_ids to filter the records by.|\n|taskGr|GlideRecord|Optional. Current task record. If taskGr is empty, this method returns the default escalation plan. If taskGr is passed, escalation policies are evaluated in order and this method returns the corresponding escalation plan.|\n\n|Type|Description|\n|----|-----------|\n|Object|A list of escalation objects to escalate to.|\n\n```\nvar groupSysId = '096fb59173062300e7af6238edf6a783';\nvar currentTime = new GlideDateTime();\nvar onCallRotation = new OnCallRotation();\nvar result = onCallRotation.getEscalationPlan(groupSysId, currentTime);\ngs.log(JSON.stringify(result));\n\n```\n\nOutput:\n\nFor single shift:\n\n```\n[\n  {\n    \"order\": 1,\n    \"userId\": \"62826bf03710200044e0bfc8bcbe5df1\",\n    \"userIds\": [],\n    \"deviceId\": \"\",\n    \"deviceIds\": [],\n    \"escalationGroups\": [],\n    \"isDevice\": false,\n    \"timeToNextStep\": null,\n    \"cmnRotaEscStepDefId\": null,\n    \"reminderNum\": 1,\n    \"rosterId\": \"9d9f399173062300e7af6238edf6a7e5\",\n    \"memberId\": \"119f399173062300e7af6238edf6a7e7\",\n    \"memberIds\": [],\n    \"isOverride\": false,\n    \"additionalEscalatees\": [],\n    \"forcedCommunicationChannel\": \"\",\n    \"rotaId\": \"349f399173062300e7af6238edf6a75e\",\n    \"groupId\": \"096fb59173062300e7af6238edf6a783\",\n    \"rotaScheduleId\": \"119f399173062300e7af6238edf6a7df\",\n    \"memberScheduleId\": \"9d9f399173062300e7af6238edf6a7ec\"\n  },\n  {\n    \"order\": 2,\n    \"userId\": \"a8f98bb0eb32010045e1a5115206fe3a\",\n    \"userIds\": [],\n    \"deviceId\": \"\",\n    \"deviceIds\": [],\n    \"escalationGroups\": [],\n    \"isDevice\": false,\n    \"timeToNextStep\": null,\n    \"cmnRotaEscStepDefId\": null,\n    \"reminderNum\": 1,\n    \"rosterId\": \"9d9f399173062300e7af6238edf6a7e5\",\n    \"memberId\": \"1d9f399173062300e7af6238edf6a7e8\",\n    \"memberIds\": [],\n    \"isOverride\": false,\n    \"additionalEscalatees\": [],\n    \"forcedCommunicationChannel\": \"\",\n    \"rotaId\": \"349f399173062300e7af6238edf6a75e\",\n    \"groupId\": \"096fb59173062300e7af6238edf6a783\",\n    \"rotaScheduleId\": \"119f399173062300e7af6238edf6a7df\",\n    \"memberScheduleId\": \"d99f399173062300e7af6238edf6a7ef\"\n  },\n  {\n    \"order\": 3,\n    \"userId\": \"0a826bf03710200044e0bfc8bcbe5d7a\",\n    \"userIds\": [],\n    \"deviceId\": \"\",\n    \"deviceIds\": [],\n    \"escalationGroups\": [],\n    \"isDevice\": false,\n    \"timeToNextStep\": null,\n    \"cmnRotaEscStepDefId\": null,\n    \"reminderNum\": 1,\n    \"rosterId\": \"9d9f399173062300e7af6238edf6a7e5\",\n    \"memberId\": \"dd9f399173062300e7af6238edf6a7e9\",\n    \"memberIds\": [],\n    \"isOverride\": false,\n    \"additionalEscalatees\": [],\n    \"forcedCommunicationChannel\": \"\",\n    \"rotaId\": \"349f399173062300e7af6238edf6a75e\",\n    \"groupId\": \"096fb59173062300e7af6238edf6a783\",\n    \"rotaScheduleId\": \"119f399173062300e7af6238edf6a7df\",\n    \"memberScheduleId\": \"519f399173062300e7af6238edf6a7f2\"\n  }\n]\n\n```\n\nFor overlapping shift:\n\n```\n[\n  {\n    \"order\": 1,\n    \"userId\": \"62826bf03710200044e0bfc8bcbe5df1\",\n    \"userIds\": [],\n    \"deviceId\": \"\",\n    \"deviceIds\": [],\n    \"escalationGroups\": [],\n    \"isDevice\": false,\n    \"timeToNextStep\": null,\n    \"cmnRotaEscStepDefId\": null,\n    \"reminderNum\": 1,\n    \"rosterId\": \"9d9f399173062300e7af6238edf6a7e5\",\n    \"memberId\": \"119f399173062300e7af6238edf6a7e7\",\n    \"memberIds\": [],\n    \"isOverride\": false,\n    \"additionalEscalatees\": [\n      {\n        \"order\": 1,\n        \"userId\": \"d2826bf03710200044e0bfc8bcbe5dc9\",\n        \"userIds\": [],\n        \"deviceId\": \"\",\n        \"deviceIds\": [],\n        \"escalationGroups\": [],\n        \"isDevice\": false,\n        \"timeToNextStep\": null,\n        \"cmnRotaEscStepDefId\": null,\n        \"reminderNum\": 1,\n        \"rosterId\": \"b5af799173062300e7af6238edf6a7a2\",\n        \"memberId\": \"7daf799173062300e7af6238edf6a7a2\",\n        \"memberIds\": [],\n        \"isOverride\": false,\n        \"additionalEscalatees\": [],\n        \"forcedCommunicationChannel\": \"\",\n        \"rotaId\": \"35af799173062300e7af6238edf6a79e\",\n        \"groupId\": \"096fb59173062300e7af6238edf6a783\",\n        \"rotaScheduleId\": \"3daf799173062300e7af6238edf6a79e\",\n        \"memberScheduleId\": \"06af799173062300e7af6238edf6a7cd\"\n      }\n    ],\n    \"forcedCommunicationChannel\": \"\",\n    \"rotaId\": \"349f399173062300e7af6238edf6a75e\",\n    \"groupId\": \"096fb59173062300e7af6238edf6a783\",\n    \"rotaScheduleId\": \"119f399173062300e7af6238edf6a7df\",\n    \"memberScheduleId\": \"9d9f399173062300e7af6238edf6a7ec\"\n  },\n  {\n    \"order\": 2,\n    \"userId\": \"a8f98bb0eb32010045e1a5115206fe3a\",\n    \"userIds\": [],\n    \"deviceId\": \"\",\n    \"deviceIds\": [],\n    \"escalationGroups\": [],\n    \"isDevice\": false,\n    \"timeToNextStep\": null,\n    \"cmnRotaEscStepDefId\": null,\n    \"reminderNum\": 1,\n    \"rosterId\": \"9d9f399173062300e7af6238edf6a7e5\",\n    \"memberId\": \"1d9f399173062300e7af6238edf6a7e8\",\n    \"memberIds\": [],\n    \"isOverride\": false,\n    \"additionalEscalatees\": [\n      {\n        \"order\": 2,\n        \"userId\": \"ee826bf03710200044e0bfc8bcbe5def\",\n        \"userIds\": [],\n        \"deviceId\": \"\",\n        \"deviceIds\": [],\n        \"escalationGroups\": [],\n        \"isDevice\": false,\n        \"timeToNextStep\": null,\n        \"cmnRotaEscStepDefId\": null,\n        \"reminderNum\": 1,\n        \"rosterId\": \"b5af799173062300e7af6238edf6a7a2\",\n        \"memberId\": \"f5af799173062300e7af6238edf6a7c9\",\n        \"memberIds\": [],\n        \"isOverride\": false,\n        \"additionalEscalatees\": [],\n        \"forcedCommunicationChannel\": \"\",\n        \"rotaId\": \"35af799173062300e7af6238edf6a79e\",\n        \"groupId\": \"096fb59173062300e7af6238edf6a783\",\n        \"rotaScheduleId\": \"3daf799173062300e7af6238edf6a79e\",\n        \"memberScheduleId\": \"8aaf799173062300e7af6238edf6a7cf\"\n      }\n    ],\n    \"forcedCommunicationChannel\": \"\",\n    \"rotaId\": \"349f399173062300e7af6238edf6a75e\",\n    \"groupId\": \"096fb59173062300e7af6238edf6a783\",\n    \"rotaScheduleId\": \"119f399173062300e7af6238edf6a7df\",\n    \"memberScheduleId\": \"d99f399173062300e7af6238edf6a7ef\"\n  },\n  {\n    \"order\": 3,\n    \"userId\": \"0a826bf03710200044e0bfc8bcbe5d7a\",\n    \"userIds\": [],\n    \"deviceId\": \"\",\n    \"deviceIds\": [],\n    \"escalationGroups\": [],\n    \"isDevice\": false,\n    \"timeToNextStep\": null,\n    \"cmnRotaEscStepDefId\": null,\n    \"reminderNum\": 1,\n    \"rosterId\": \"9d9f399173062300e7af6238edf6a7e5\",\n    \"memberId\": \"dd9f399173062300e7af6238edf6a7e9\",\n    \"memberIds\": [],\n    \"isOverride\": false,\n    \"additionalEscalatees\": [\n      {\n        \"order\": 3,\n        \"userId\": \"e2826bf03710200044e0bfc8bcbe5de0\",\n        \"userIds\": [],\n        \"deviceId\": \"\",\n        \"deviceIds\": [],\n        \"escalationGroups\": [],\n        \"isDevice\": false,\n        \"timeToNextStep\": null,\n        \"cmnRotaEscStepDefId\": null,\n        \"reminderNum\": 1,\n        \"rosterId\": \"b5af799173062300e7af6238edf6a7a2\",\n        \"memberId\": \"8aaf799173062300e7af6238edf6a7ca\",\n        \"memberIds\": [],\n        \"isOverride\": false,\n        \"additionalEscalatees\": [],\n        \"forcedCommunicationChannel\": \"\",\n        \"rotaId\": \"35af799173062300e7af6238edf6a79e\",\n        \"groupId\": \"096fb59173062300e7af6238edf6a783\",\n        \"rotaScheduleId\": \"3daf799173062300e7af6238edf6a79e\",\n        \"memberScheduleId\": \"02af799173062300e7af6238edf6a7d2\"\n      }\n    ],\n    \"forcedCommunicationChannel\": \"\",\n    \"rotaId\": \"349f399173062300e7af6238edf6a75e\",\n    \"groupId\": \"096fb59173062300e7af6238edf6a783\",\n    \"rotaScheduleId\": \"119f399173062300e7af6238edf6a7df\",\n    \"memberScheduleId\": \"519f399173062300e7af6238edf6a7f2\"\n  }\n]\n\n```\n\nFor custom escalation:\n\n```\n[\n  {\n    \"order\": 1,\n    \"userId\": \"\",\n    \"userIds\": [\n      \"62826bf03710200044e0bfc8bcbe5df1\",\n      \"46d44a23a9fe19810012d100cca80666\"\n    ],\n    \"deviceId\": \"\",\n    \"deviceIds\": [],\n    \"escalationGroups\": [\n      \"a715cd759f2002002920bde8132e7018\"\n    ],\n    \"isDevice\": false,\n    \"timeBetweenReminders\": {},\n    \"timeToNextStep\": {},\n    \"cmnRotaEscStepDefId\": \"655042d173062300e7af6238edf6a738\",\n    \"reminderNum\": 1,\n    \"rosterId\": \"\",\n    \"memberId\": \"\",\n    \"memberIds\": [],\n    \"isOverride\": false,\n    \"additionalEscalatees\": [],\n    \"forcedCommunicationChannel\": \"\",\n    \"rotaId\": \"349f399173062300e7af6238edf6a75e\",\n    \"groupId\": \"096fb59173062300e7af6238edf6a783\",\n    \"rotaScheduleId\": \"119f399173062300e7af6238edf6a7df\",\n    \"memberScheduleId\": \"\"\n  },\n  {\n    \"order\": 2,\n    \"userId\": \"\",\n    \"userIds\": [],\n    \"deviceId\": \"\",\n    \"deviceIds\": [],\n    \"escalationGroups\": [],\n    \"isDevice\": false,\n    \"timeBetweenReminders\": {},\n    \"timeToNextStep\": {},\n    \"cmnRotaEscStepDefId\": \"8b6042d173062300e7af6238edf6a7f3\",\n    \"reminderNum\": 1,\n    \"rosterId\": \"\",\n    \"memberId\": \"\",\n    \"memberIds\": [],\n    \"isOverride\": false,\n    \"additionalEscalatees\": [],\n    \"forcedCommunicationChannel\": \"\",\n    \"rotaId\": \"349f399173062300e7af6238edf6a75e\",\n    \"groupId\": \"096fb59173062300e7af6238edf6a783\",\n    \"rotaScheduleId\": \"119f399173062300e7af6238edf6a7df\",\n    \"memberScheduleId\": \"\"\n  }\n]\n\n```\n\n```\n/**\n* create a custom escalation for service desk shift with condition as P1 for Incident\n* taskGr is optional parameter\n* if taskGr is empty then it returns default escalation plan\n* if taskGr is passed then escalation policies are executed evaluated in order and corresponding escalation plan is returned\n**/\n\nvar serviceDeskSysId = 'd625dccec0a8016700a222a0f7900d06';\nvar taskGr = new GlideRecord('incident');\ntaskGr.get('ed92e8d173d023002728660c4cf6a7bc');\n\nvar ocRotation = new OnCallRotation();\nvar escalationPlan = ocRotation.getEscalationPlan(serviceDeskSysId, null, null, taskGr);\ngs.log(JSON.stringify(escalationPlan));\n```\n\n## OnCallRotation - getEscalationType\\(String rotaID\\)\n\nGets 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.\n\n|Name|Type|Description|\n|----|----|-----------|\n|rotaID|String|The sys\\_id for the rota to check for rosters.|\n\n<table id=\"table_bvq_4zf_2w\" class=\"returns\"><thead><tr><th>\n\nType\n\n</th><th>\n\nDescription\n\n</th></tr></thead><tbody><tr><td>\n\nString\n\n</td><td>\n\n-   Member: if there is one roster in the rota.\n-   Roster: if there is more than one roster in the rota.\n-   No rosters in this rota: if none of the above.\n-   Custom: If the custom escalation is applicable.\n\n</td></tr></tbody>\n</table>```\nvar rotaSysId = '349f399173062300e7af6238edf6a75e';\nvar onCallRotation = new OnCallRotation();\nvar escalationType = onCallRotation.getEscalationType(rotaSysId);\ngs.log(escalationType);\n\n```\n\nOutput:\n\n```\ncustom\n```\n\n## OnCallRotation - getEscalateesAt\\(String groupSysId, GlideDateTime gdt, Number position, GlideRecord taskGr\\)\n\nGets 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.\n\n**Note:** Set the taskGR parameter to enable escalation plan evaluation.\n\n|Name|Type|Description|\n|----|----|-----------|\n|groupSysId|String|ys\\_id of the group.|\n|gdt|GlideDateTime|yyyy-MM-dd HH:mm:ss format in the UTC timezone. Default is now.|\n|position|Number|Position of the escalation step.|\n|taskGr|GlideRecord|Optional. Current task record. If taskGr is empty, this method returns the default escalation plan. If taskGr is passed, escalation policies are evaluated in order and this method returns the corresponding escalation plan.|\n\n|Type|Description|\n|----|-----------|\n|GlideRecord|Array of escalatees \\(either a user, group, or device records depending on the notification rules\\) at a specific time and position.|\n\n```\nvar groupSysId = '096fb59173062300e7af6238edf6a783';\nvar currentTime = new GlideDateTime();\nvar onCallRotation = new OnCallRotation();\nvar escalatees = onCallRotation.getEscalateesAt(groupSysId, currentTime, 1);\nfor (var i = 0; i < escalatees.length; i++) {\ngs.log(escalatees[i].name);\n}\n\n```\n\nOutput:\n\nFor overlapping shifts:\n\n```\nAbel Tuter\nBarbara Hindley\n\n```\n\nFor custom escalation:\n\n```\nAbel Tuter\nBeth Anglin\nChange Management\nBarbara Hindley\n\n```\n\n```\n// Create a custom escalation for service desk shift with condition as P1 for Incident\nvar serviceDeskSysId = 'd625dccec0a8016700a222a0f7900d06';\n// optional parameter taskGR\nvar taskGr = new GlideRecord('incident');\ntaskGr.get('ed92e8d173d023002728660c4cf6a7bc');\n\nvar ocRotation = new OnCallRotation();\nvar position = 1;\nvar escalatees = ocRotation.getEscalateesAt(serviceDeskSysId, new GlideDateTime(), position, taskGr);\n\n// if taskGr is empty then it returns escalatees at a position in default escalation plan\n// if taskGr is passed then escalation policies are executed evaluated in order and escalatees at a position in corresponding escalation plan is returned\nfor (var i = 0; i < escalatees.length; i++) {\n    gs.log(escalatees[i].getDisplayValue());\n}\n```\n\n## OnCallRotation - getPrimaryUser\\(\\)\n\nGets the sys\\_id of the current primary contact when there is a single shift.\n\n|Name|Type|Description|\n|----|----|-----------|\n|None| | |\n\n|Type|Description|\n|----|-----------|\n|String|sys\\_id of the current primary contact.|\n\nExample:\n\n```\n\nvar groupSysId = '096fb59173062300e7af6238edf6a783';\nvar currentTime = new GlideDateTime();\nvar onCallRotation = new OnCallRotation();\nvar result = onCallRotation.who(groupSysId, currentTime);\nvar primaryUser = onCallRotation.getPrimaryUser();\n\n```\n\nOutput:\n\n```\n62826bf03710200044e0bfc8bcbe5df1\n```\n\n## OnCallRotation - getPrimaryUserByRota\\(String rotaId\\)\n\nGets the sys\\_id of the current primary user of the specified shift. This API is applicable for a single shift and overlapping shifts.\n\n|Name|Type|Description|\n|----|----|-----------|\n|rotaId|String|sys\\_id of the cmn\\_rota.|\n\n|Type|Description|\n|----|-----------|\n|String|sys\\_id of the current primary user of the specified shift.|\n\n```\n\nvar groupSysId = '096fb59173062300e7af6238edf6a783';\nvar rotaId = '349f399173062300e7af6238edf6a75e';\nvar currentTime = new GlideDateTime();\nvar onCallRotation = new OnCallRotation();\nvar result = onCallRotation.who(groupSysId, currentTime);\nvar primaryUser = onCallRotation.getPrimaryUserByRota(rotaId);\ngs.log(primaryUser);\n\n```\n\nOutput:\n\n```\n62826bf03710200044e0bfc8bcbe5df1\n```\n\n## OnCallRotation - getPrimaryUserName\\(\\)\n\nGets the name of the current primary contact. This API is applicable for a single shift.\n\n|Name|Type|Description|\n|----|----|-----------|\n|None| | |\n\n|Type|Description|\n|----|-----------|\n|String|Name of the current primary contact.|\n\n```\n\nvar groupSysId = '096fb59173062300e7af6238edf6a783';\nvar currentTime = new GlideDateTime();\nvar onCallRotation = new OnCallRotation();\nvar result = onCallRotation.who(groupSysId, currentTime);\nvar primaryUser = onCallRotation.getPrimaryUserName();\ngs.log(primaryUser);\n\n```\n\nOutput:\n\n```\nAbel Tuter\n```\n\n## OnCallRotation - getPrimaryUserNameByRota\\(String rotaId\\)\n\nGets the name of the current primary user of the specified shift. This API is applicable for a single shift and overlapping shifts.\n\n|Name|Type|Description|\n|----|----|-----------|\n|rotaId|String|sys\\_id of the cmn\\_rota.|\n\n|Type|Description|\n|----|-----------|\n|String|Name of the current primary user of the specified shift.|\n\n```\n\nvar groupSysId = '096fb59173062300e7af6238edf6a783';\nvar rotaId = '349f399173062300e7af6238edf6a75e';\nvar currentTime = new GlideDateTime();\nvar onCallRotation = new OnCallRotation();\nvar result = onCallRotation.who(groupSysId, currentTime);\nvar primaryUser = onCallRotation.getPrimaryUserNameByRota(rotaId);\ngs.log(primaryUser);\n\n```\n\nOutput:\n\n```\nAbel Tuter\n```\n\n## OnCallRotation - getPrimaryUsers\\(\\)\n\nGets the list of primary contacts for a shift. This API is applicable for a single shift, overlapping shifts, and custom escalation.\n\n|Name|Type|Description|\n|----|----|-----------|\n|None| | |\n\n|Type|Description|\n|----|-----------|\n|Object|List of primary contacts.|\n\n```\n\nvar groupSysId = '096fb59173062300e7af6238edf6a783';\nvar currentTime = new GlideDateTime();\nvar onCallRotation = new OnCallRotation();\nvar result = onCallRotation.who(groupSysId, currentTime);\nvar primaryUser = onCallRotation.getPrimaryUser();\ngs.log(JSON.stringify(primaryUser));\n\n```\n\nOutput:\n\n```\n{\n  \"349f399173062300e7af6238edf6a75e\": {\n    \"userSysId\": \"62826bf03710200044e0bfc8bcbe5df1\",\n    \"userName\": \"Abel Tuter\"\n  },\n  \"35af799173062300e7af6238edf6a79e\": {\n    \"userSysId\": \"d2826bf03710200044e0bfc8bcbe5dc9\",\n    \"userName\": \"Barbara Hindley\"\n  }\n}\n\n```\n\n## OnCallRotation - spansOverlap\\(ArrayList parent, ArrayList child, String timeZone\\)\n\nChecks if the parent span and child spans overlap.\n\n|Name|Type|Description|\n|----|----|-----------|\n|parent|ArrayList|The parent spans to compare.|\n|child|ArrayList|The child spans to compare.|\n|timeZone|String|The name of the time zone.|\n\n|Type|Description|\n|----|-----------|\n|Boolean|Returns true if the parent and child spans overlap.|\n\n```\nvar onCall = new OnCallRotation();\n \n// get a time range we are interested in\nvar timeZone = gs.getSession().getTimeZoneName();\nvar dateStart = new GlideDateTime();\nvar dateEnd = new GlideDateTime().addMonths(1);\n \n// convert glidedatime to scheduledatetime because it is required\n// by the function being called below\nvar scheduleStart = new GlideScheduleDateTime(dateStart);\nvar scheduleEnd =  new GlideScheduleDateTime(dateEnd);\nscheduleStart.setTimeZone(timeZone);\nscheduleEnd.setTimeZone(timeZone);\n \n// calculate rotation items based on the date and time given\n// for all the groups the currently logged in user is a member of\ngs.include(\"OnCallRotationPersonal\");\nvar rotation = new OnCallRotationPersonal();\nvar myGroups = gs.getUser().getMyGroups();\nvar groupIter = myGroups.iterator();\n \nwhile(groupIter.hasNext()){\n\tvar rotaItems = rotation.onCallDuringPeriod(groupIter.next(), scheduleStart, scheduleEnd);\n \n\t// loop through rotation schedules\n\tfor (var i = 0; i < rotaItems.length - 1; i++) {\n\t\tvar parentItem = rotaItems[i];\n\t\tvar nextItem = rotaItems[i + 1];\n \n\t\t// check if previous and next time spans overlap\n\t\tvar overlaps = onCall.spansOverlap(parentItem.getTimeSpans(), nextItem.getTimeSpans(), \n\t\t\tgs.getSession().getTimeZoneName());\n\t}\n}\n```\n\n## OnCallRotation - startEscalations\\(GlideRecord now\\_GR, String eventName, String escalationScriptName\\)\n\nStart 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.\n\n|Name|Type|Description|\n|----|----|-----------|\n|now\\_GR|GlideRecord|Document glide record. For example, Incident now\\_GR.|\n|eventName|String|Event name for the escalation notifications.|\n|escalationScriptName|String|Business rule to call when escalation occurs|\n\n|Type|Description|\n|----|-----------|\n|void| |\n\n## OnCallRotation - who\\(String groupSysId, GlideDateTime gdt, Boolean nullifyOverrideRoster, String rotaSysIds, Boolean overrideCustomEscalation, GlideRecord taskGR\\)\n\nSpecifies if there is an on-call user, group, or device. This method is applicable for a single shift, overlapping shifts, and custom escalation.\n\n**Note:** Pass the **taskGR** parameter to enable escalation plan evaluation.\n\n<table id=\"table_xgb_ypj_3gb\" class=\"parameters\"><thead><tr><th>\n\nName\n\n</th><th>\n\nType\n\n</th><th>\n\nDescription\n\n</th></tr></thead><tbody><tr><td>\n\ngroupSysId\n\n</td><td>\n\nString\n\n</td><td>\n\nSys\\_id of the group to check for.\n\n</td></tr><tr><td>\n\ngdt\n\n</td><td>\n\n[GlideDateTime](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/api-reference/server-api-reference/c_GlideDateTimeAPI.md)\n\n</td><td>\n\nDate and time.Format: yyyy-MM-dd HH:mm:ss in the UTC time zone\n\nDefault: Current date and time\n\n</td></tr><tr><td>\n\nnullifyOverrideRoster\n\n</td><td>\n\nBoolean\n\n</td><td>\n\nFlag that indicates whether the notification list for the group is for a specific roster.Valid values:\n\n-   true: Not for a specific roster.\n-   false: For a specific roster.\n\n</td></tr><tr><td>\n\nrotaSysIds\n\n</td><td>\n\nString\n\n</td><td>\n\nComma-separated list of cmn\\_rota sys\\_ids to filter the records by.\n\n</td></tr><tr><td>\n\noverrideCustomEscalation\n\n</td><td>\n\nBoolean\n\n</td><td>\n\nFlag that indicates whether to override the default escalation policy with the custom escalation. Valid values:\n\n-   true: Override the default escalation policy.\n-   false: Do not override the default escalation policy.\n\n</td></tr><tr><td>\n\ntaskGR\n\n</td><td>\n\n[GlideRecord](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/api-reference/server-api-reference/c_GlideRecordAPI.md)\n\n</td><td>\n\nOptional. Current task record. If passed, the method populates the escalatees based on the escalation conditions.\n\n</td></tr></tbody>\n</table><table id=\"table_lzh_1rj_3gb\" class=\"returns\"><thead><tr><th>\n\nType\n\n</th><th>\n\nDescription\n\n</th></tr></thead><tbody><tr><td>\n\nBoolean\n\n</td><td>\n\nFlag that indicates whether a match was found.Possible values:\n\n-   true: At least one match was found.\n-   false: No matches were found.\n\n</td></tr></tbody>\n</table>```\nvar groupSysId = '096fb59173062300e7af6238edf6a783';\nvar currentTime = new GlideDateTime();\nvar onCallRotation = new OnCallRotation();\nvar result = onCallRotation.who(groupSysId, currentTime);\ngs.log(result);\n```\n\nOutput:\n\n```\ntrue\n```\n\nThe following example shows how to create a custom escalation for service desk shift with condition P1 for an incident.\n\n```\n/**\n * When the who() method is invoked with the optional taskGr parameter, \n * escalatees are populated based on the conditional escalations\n**/\n\nvar serviceDeskSysId = 'd625dccec0a8016700a222a0f7900d06';\nvar taskGr = new GlideRecord('incident');\ntaskGr.get('ed92e8d173d023002728660c4cf6a7bc');\n\nvar ocRotation = new OnCallRotation();\nocRotation.who(serviceDeskSysId, null, null, null, null, taskGr);\nwhile (ocRotation.next()) {\n    gs.log(ocRotation.getUserName());\n}\n```\n\nOutput:\n\n```\nBeth Anglin\n```\n\n## OnCallRotation - whoAt\\(String groupSysId, GlideDateTime gdt, String rotaSysIds\\)\n\nSpecifies if there is an on-call user, group, or device. This API is applicable for a single shift, overlapping shifts, and custom escalation.\n\n|Name|Type|Description|\n|----|----|-----------|\n|groupSysId|String|Sys ID of the group.|\n|gdt|GlideDateTime|yyyy-MM-dd HH:mm:ss format in the UTC timezone. Default is now.|\n|rotaSysIds|String|Comma-separated list of cmn\\_rota Sys IDs to filter the records by.|\n\n|Type|Description|\n|----|-----------|\n|Boolean|True if there is at least one on-call user, group, or device; false otherwise.|\n\n```\n\nvar groupSysId = '096fb59173062300e7af6238edf6a783';\nvar currentTime = new GlideDateTime();\nvar onCallRotation = new OnCallRotation();\nvar result = onCallRotation.whoAt(groupSysId, currentTime);\ngs.log(result);\n\n```\n\nOutput:\n\n```\ntrue\n```\n\n## OnCallRotation - whoIsOnCall\\(String groupSysIds, String rotaSysIds, String rosterSysIds, GlideDateTime gdt\\)\n\nGets 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.\n\n|Name|Type|Description|\n|----|----|-----------|\n|groupSysIds|String|Comma-separated list of sys\\_ids of the sys\\_user\\_group, to filter the records by.|\n|rotaSysIds|String|Comma-separated list of cmn\\_rota sys\\_ids to filter the records by.|\n|rosterSysIds|String|Comma-separated list of cmn\\_rota\\_roster sys\\_ids to filter the records by.|\n|gdt|GlideDateTime|Date in the UTC timezone|\n\n|Type|Description|\n|----|-----------|\n|Object|List of users, groups, or devices that are on-call at a given time. For example, information about userIds, deviceIds, and escalationGroups.|\n\n```\nvar groupSysId = '096fb59173062300e7af6238edf6a783';\nvar currentTime = new GlideDateTime();\nvar onCallRotation = new OnCallRotation();\nvar escalatees = onCallRotation. whoIsOnCall(groupSysId, \"\", \"\", currentTime);\ngs.log(JSON.stringify(escalatees));\n\n```\n\nOutput:\n\nFor single shift:\n\n```\n[\n  {\n    \"memberId\": \"119f399173062300e7af6238edf6a7e7\",\n    \"memberIds\": [],\n    \"userId\": \"62826bf03710200044e0bfc8bcbe5df1\",\n    \"userIds\": [],\n    \"roster\": \"9d9f399173062300e7af6238edf6a7e5\",\n    \"rota\": \"349f399173062300e7af6238edf6a75e\",\n    \"group\": \"096fb59173062300e7af6238edf6a783\",\n    \"escalationGroups\": [],\n    \"deviceId\": \"\",\n    \"deviceIds\": [],\n    \"isDevice\": false,\n    \"order\": 1,\n    \"isOverride\": false,\n    \"rotationScheduleId\": \"119f399173062300e7af6238edf6a7df\",\n    \"memberScheduleId\": \"9d9f399173062300e7af6238edf6a7ec\"\n  },\n  {\n    \"memberId\": \"1d9f399173062300e7af6238edf6a7e8\",\n    \"memberIds\": [],\n    \"userId\": \"a8f98bb0eb32010045e1a5115206fe3a\",\n    \"userIds\": [],\n    \"roster\": \"9d9f399173062300e7af6238edf6a7e5\",\n    \"rota\": \"349f399173062300e7af6238edf6a75e\",\n    \"group\": \"096fb59173062300e7af6238edf6a783\",\n    \"escalationGroups\": [],\n    \"deviceId\": \"\",\n    \"deviceIds\": [],\n    \"isDevice\": false,\n    \"order\": 2,\n    \"isOverride\": false,\n    \"rotationScheduleId\": \"119f399173062300e7af6238edf6a7df\",\n    \"memberScheduleId\": \"d99f399173062300e7af6238edf6a7ef\"\n  },\n  {\n    \"memberId\": \"dd9f399173062300e7af6238edf6a7e9\",\n    \"memberIds\": [],\n    \"userId\": \"0a826bf03710200044e0bfc8bcbe5d7a\",\n    \"userIds\": [],\n    \"roster\": \"9d9f399173062300e7af6238edf6a7e5\",\n    \"rota\": \"349f399173062300e7af6238edf6a75e\",\n    \"group\": \"096fb59173062300e7af6238edf6a783\",\n    \"escalationGroups\": [],\n    \"deviceId\": \"\",\n    \"deviceIds\": [],\n    \"isDevice\": false,\n    \"order\": 3,\n    \"isOverride\": false,\n    \"rotationScheduleId\": \"119f399173062300e7af6238edf6a7df\",\n    \"memberScheduleId\": \"519f399173062300e7af6238edf6a7f2\"\n  }\n]\n\n```\n\nFor overlapping shift:\n\n```\n[\n  {\n    \"memberId\": \"119f399173062300e7af6238edf6a7e7\",\n    \"memberIds\": [],\n    \"userId\": \"62826bf03710200044e0bfc8bcbe5df1\",\n    \"userIds\": [],\n    \"roster\": \"9d9f399173062300e7af6238edf6a7e5\",\n    \"rota\": \"349f399173062300e7af6238edf6a75e\",\n    \"group\": \"096fb59173062300e7af6238edf6a783\",\n    \"escalationGroups\": [],\n    \"deviceId\": \"\",\n    \"deviceIds\": [],\n    \"isDevice\": false,\n    \"order\": 1,\n    \"isOverride\": false,\n    \"rotationScheduleId\": \"119f399173062300e7af6238edf6a7df\",\n    \"memberScheduleId\": \"9d9f399173062300e7af6238edf6a7ec\"\n  },\n  {\n    \"memberId\": \"7daf799173062300e7af6238edf6a7a2\",\n    \"memberIds\": [],\n    \"userId\": \"d2826bf03710200044e0bfc8bcbe5dc9\",\n    \"userIds\": [],\n    \"roster\": \"b5af799173062300e7af6238edf6a7a2\",\n    \"rota\": \"35af799173062300e7af6238edf6a79e\",\n    \"group\": \"096fb59173062300e7af6238edf6a783\",\n    \"escalationGroups\": [],\n    \"deviceId\": \"\",\n    \"deviceIds\": [],\n    \"isDevice\": false,\n    \"order\": 1,\n    \"isOverride\": false,\n    \"rotationScheduleId\": \"3daf799173062300e7af6238edf6a79e\",\n    \"memberScheduleId\": \"06af799173062300e7af6238edf6a7cd\"\n  },\n  {\n    \"memberId\": \"1d9f399173062300e7af6238edf6a7e8\",\n    \"memberIds\": [],\n    \"userId\": \"a8f98bb0eb32010045e1a5115206fe3a\",\n    \"userIds\": [],\n    \"roster\": \"9d9f399173062300e7af6238edf6a7e5\",\n    \"rota\": \"349f399173062300e7af6238edf6a75e\",\n    \"group\": \"096fb59173062300e7af6238edf6a783\",\n    \"escalationGroups\": [],\n    \"deviceId\": \"\",\n    \"deviceIds\": [],\n    \"isDevice\": false,\n    \"order\": 2,\n    \"isOverride\": false,\n    \"rotationScheduleId\": \"119f399173062300e7af6238edf6a7df\",\n    \"memberScheduleId\": \"d99f399173062300e7af6238edf6a7ef\"\n  },\n  {\n    \"memberId\": \"f5af799173062300e7af6238edf6a7c9\",\n    \"memberIds\": [],\n    \"userId\": \"ee826bf03710200044e0bfc8bcbe5def\",\n    \"userIds\": [],\n    \"roster\": \"b5af799173062300e7af6238edf6a7a2\",\n    \"rota\": \"35af799173062300e7af6238edf6a79e\",\n    \"group\": \"096fb59173062300e7af6238edf6a783\",\n    \"escalationGroups\": [],\n    \"deviceId\": \"\",\n    \"deviceIds\": [],\n    \"isDevice\": false,\n    \"order\": 2,\n    \"isOverride\": false,\n    \"rotationScheduleId\": \"3daf799173062300e7af6238edf6a79e\",\n    \"memberScheduleId\": \"8aaf799173062300e7af6238edf6a7cf\"\n  },\n  {\n    \"memberId\": \"dd9f399173062300e7af6238edf6a7e9\",\n    \"memberIds\": [],\n    \"userId\": \"0a826bf03710200044e0bfc8bcbe5d7a\",\n    \"userIds\": [],\n    \"roster\": \"9d9f399173062300e7af6238edf6a7e5\",\n    \"rota\": \"349f399173062300e7af6238edf6a75e\",\n    \"group\": \"096fb59173062300e7af6238edf6a783\",\n    \"escalationGroups\": [],\n    \"deviceId\": \"\",\n    \"deviceIds\": [],\n    \"isDevice\": false,\n    \"order\": 3,\n    \"isOverride\": false,\n    \"rotationScheduleId\": \"119f399173062300e7af6238edf6a7df\",\n    \"memberScheduleId\": \"519f399173062300e7af6238edf6a7f2\"\n  },\n  {\n    \"memberId\": \"8aaf799173062300e7af6238edf6a7ca\",\n    \"memberIds\": [],\n    \"userId\": \"e2826bf03710200044e0bfc8bcbe5de0\",\n    \"userIds\": [],\n    \"roster\": \"b5af799173062300e7af6238edf6a7a2\",\n    \"rota\": \"35af799173062300e7af6238edf6a79e\",\n    \"group\": \"096fb59173062300e7af6238edf6a783\",\n    \"escalationGroups\": [],\n    \"deviceId\": \"\",\n    \"deviceIds\": [],\n    \"isDevice\": false,\n    \"order\": 3,\n    \"isOverride\": false,\n    \"rotationScheduleId\": \"3daf799173062300e7af6238edf6a79e\",\n    \"memberScheduleId\": \"02af799173062300e7af6238edf6a7d2\"\n  }\n]\n\n```\n\n## OnCallRotation - whoIsNext\\(GlideRecord escalationGr\\)\n\nEscalation 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.\n\n|Name|Type|Description|\n|----|----|-----------|\n|escalationGr|GlideRecord|GlideRecord of Rotation escalation \\[cmn\\_rota\\_escalation\\].|\n\n|Type|Description|\n|----|-----------|\n|None| |\n\n"}}