---
sourceDocument: Xanadu API Reference
sourceDocumentLink: https://servicenow-prod.fluidtopics.net/r/xanadu/api-reference

 Release :

    - xanadu

ft:locale :

    - en-US

ft:publication_title :

    - Xanadu API Reference

ft:clusterId :

    - crapiref

bundleId :

    - crapiref

workflow :

    - Creator


---

# OCRotation - Global

# OCRotation - Global {#ariaid-title1}

* Release version: Xanadu
* 
* Updated August 1, 2024
* 
* ![](https://www.servicenow.com/docs/portal-asset/ico-clock) 4 minutes to read

The OCRotation script include provides methods to build a data structure that is used to display a calendar.

The code builds up the GlideAJAXSchedulePage object which stores a list of span items. You can use this type for the Gwt (legacy) calendar. See the [OCRotationV2 - Global](https://servicenow-prod.fluidtopics.net/8K0SozSVYQarByNcG9K65w#c_OCRotationV2 "The OCRotationV2 script include is an extension of OCRotation script include, which is used by Fullcalendar.io and the DHTMLX On-Call Calendar.") script include for other calender types. This is part of On-Call Scheduling.

## OCRotation - buildRotas() {#ariaid-title2}

Builds the on-call coverage based on your groups, rotas, and rosters. This is used by
the OCRotationV2 - getSpans method.
{#r_OCRotation-buildrotas__table_bl2_jhb_h5__entry__3}

| Name | Type | Description |
|-|-|-|
| None |   |   |
[Table 1. Parameters]

{#r_OCRotation-buildrotas__table_bl2_jhb_h5} {#r_OCRotation-buildrotas__table_cl2_jhb_h5__entry__2}

| Type | Description |
|-|-|
| Void |   |
[Table 2. Returns]

{#r_OCRotation-buildrotas__table_cl2_jhb_h5}
**Related reference**   

* [OCRotationV2 - getSpans()](https://servicenow-prod.fluidtopics.net/8K0SozSVYQarByNcG9K65w#r_OCRotationV2-getSpans "Get the spans from the specified start date to the specified end date. If no start and end dates are provided, the start date defaults to a month before and the end date defaults to a month after the current time. You can also use the groups IDs, rota IDs, roster IDs, user IDs to further filter the spans.")

## OCRotation - getEndDate() {#ariaid-title3}

Returns the end date for the time period for which you want to retrieve on-call
coverage.
{#r_OCRotation-getEndDate__table_ljb_njx_g5__entry__3}

| Name | Type | Description |
|-|-|-|
| None |   |   |
[Table 3. Parameters]

{#r_OCRotation-getEndDate__table_ljb_njx_g5} {#r_OCRotation-getEndDate__table_mjb_njx_g5__entry__2}

| Type | Description |
|-|-|
| String | End date for the time period for which you want to retrieve on-call coverage. |
[Table 4. Returns]

{#r_OCRotation-getEndDate__table_mjb_njx_g5}

## OCRotation - getGroupIds() {#ariaid-title4}

Returns a comma separated list of group sys_id (sys_user_group) values for an on-call
schedule.
{#r_OCRotation-getGroupIDs__table_d2s_nnx_g5__entry__3}

| Name | Type | Description |
|-|-|-|
| None |   |   |
[Table 5. Parameters]

{#r_OCRotation-getGroupIDs__table_d2s_nnx_g5} {#r_OCRotation-getGroupIDs__table_e2s_nnx_g5__entry__2}

| Type | Description |
|-|-|
| String | Comma separated list of group sys_id (sys_user_group) values for an on-call schedule. |
[Table 6. Returns]

{#r_OCRotation-getGroupIDs__table_e2s_nnx_g5}

## OCRotation - getRosterIds() {#ariaid-title5}

Returns the rosters according to the selected rotas.
{#r_OCRotation-getRosterIDs__table_kcq_gcb_h5__entry__3}

| Name | Type | Description |
|-|-|-|
| None |   |   |
[Table 7. Parameters]

{#r_OCRotation-getRosterIDs__table_kcq_gcb_h5} {#r_OCRotation-getRosterIDs__table_lcq_gcb_h5__entry__2}

| Type | Description |
|-|-|
| String | Rosters according to the selected rotas. |
[Table 8. Returns]

{#r_OCRotation-getRosterIDs__table_lcq_gcb_h5}

## OCRotation - getRotaGr(String rotaIds, String groupIds, String rosterIds, String
userIds) {#ariaid-title6}

Returns a GlideRecord for the cmn_rota table filtered by groups, rota, users, and
roster.
{#r_OCRotation-getrotaGr_String_String_String_String__table_r4x_prm_45__entry__3}

| Name | Type | Description |
|-|-|-|
| rotaIds | String | Comma separated list of rota sys_id (cmn_rota) values for an on-call schedule. |
| groupIds | String | Comma separated list of group sys_id (sys_user_group) values for an on-call schedule. |
| rosterIds | String | Comma separated list of roster sys_id (cmn_rota_roster) values for an on-call schedule. |
| userIds | String | Comma separated list of user sys_id (sys_user) values for an on-call schedule. |
[Table 9. Parameters]

{#r_OCRotation-getrotaGr_String_String_String_String__table_r4x_prm_45} {#r_OCRotation-getrotaGr_String_String_String_String__table_s4x_prm_45__entry__2}

| Type | Description |
|-|-|
| GlideRecord | A GlideRecord for the cmn_rota table filtered by groups, rota, users, and roster. |
[Table 10. Returns]

{#r_OCRotation-getrotaGr_String_String_String_String__table_s4x_prm_45}

## OCRotation - getRotaIds() {#ariaid-title7}

Returns the rotas for the groups on your calendar.
{#r_OCRotation-getRotaIDs__table_ycs_rbb_h5__entry__3}

| Name | Type | Description |
|-|-|-|
| None |   |   |
[Table 11. Parameters]

{#r_OCRotation-getRotaIDs__table_ycs_rbb_h5} {#r_OCRotation-getRotaIDs__table_zcs_rbb_h5__entry__2}

| Type | Description |
|-|-|
| String | Rotas for the groups on your calendar. |
[Table 12. Returns]

{#r_OCRotation-getRotaIDs__table_zcs_rbb_h5}

## OCRotation - getStartDate() {#ariaid-title8}

Returns the start date for the time period for which you want to retrieve on-call
coverage.
{#r_OCRotation-getStartDate__table_asg_l3r_g5__entry__3}

| Name | Type | Description |
|-|-|-|
| None |   |   |
[Table 13. Parameters]

{#r_OCRotation-getStartDate__table_asg_l3r_g5} {#r_OCRotation-getStartDate__table_bsg_l3r_g5__entry__2}

| Type | Description |
|-|-|
| String | Start date for the time period for which you want to retrieve on-call coverage. |
[Table 14. Returns]

{#r_OCRotation-getStartDate__table_bsg_l3r_g5}

## OCRotation - getTimezone() {#ariaid-title9}

Returns the timezone that your on-call calendar will use.
{#r_OCRotation-getTimezone__table_u5g_kkx_g5__entry__3}

| Name | Type | Description |
|-|-|-|
| None |   |   |
[Table 15. Parameters]

{#r_OCRotation-getTimezone__table_u5g_kkx_g5} {#r_OCRotation-getTimezone__table_v5g_kkx_g5__entry__2}

| Type | Description |
|-|-|
| String | Timezone that your on-call calendar will use. For example, Europe/Madrid and US/Pacific. |
[Table 16. Returns]

{#r_OCRotation-getTimezone__table_v5g_kkx_g5}

## OCRotation - getUserIDs() {#ariaid-title10}

This will filter the schedules return by users. Get comma separated list of user sys_id
(sys_user) values used to filter on-call schedules.
{#r_OCRotation-getUserIDs__table_y3n_5cb_h5__entry__3}

| Name | Type | Description |
|-|-|-|
| None |   |   |
[Table 17. Parameters]

{#r_OCRotation-getUserIDs__table_y3n_5cb_h5} {#r_OCRotation-getUserIDs__table_z3n_5cb_h5__entry__2}

| Type | Description |
|-|-|
| String | Comma separated list of user sys_id (sys_user) values used to filter on-call schedules. |
[Table 18. Returns]

{#r_OCRotation-getUserIDs__table_z3n_5cb_h5}

## OCRotation - setEndDate(String endDate, Boolean inclusive) {#ariaid-title11}

Set the end date for the time period for which you want to retrieve on-call coverage.
If the end date is not set, then the last day of the next month is applied by default. Use in
conjunction with OCRotationV2 - getSpans.
{#r_OCRotation-setEndDate_String_B__table_rvb_dkx_g5__entry__3}

| Name | Type | Description |
|-|-|-|
| endDate | String | \[Optional\] End date of the on-call schedule. |
| inclusive | Boolean | \[Optional\] When true, the end date is included in the time span. If not specified, this value defaults to true. |
[Table 19. Parameters]

{#r_OCRotation-setEndDate_String_B__table_rvb_dkx_g5} {#r_OCRotation-setEndDate_String_B__table_svb_dkx_g5__entry__2}

| Type | Description |
|-|-|
| Void |   |
[Table 20. Returns]

{#r_OCRotation-setEndDate_String_B__table_svb_dkx_g5}
**Related reference**   

* [OCRotationV2 - getSpans()](https://servicenow-prod.fluidtopics.net/8K0SozSVYQarByNcG9K65w#r_OCRotationV2-getSpans "Get the spans from the specified start date to the specified end date. If no start and end dates are provided, the start date defaults to a month before and the end date defaults to a month after the current time. You can also use the groups IDs, rota IDs, roster IDs, user IDs to further filter the spans.")

## OCRotation - setGroupIds(String groupIds) {#ariaid-title12}

Filters the schedules return by groups. Set comma separated list of group sys_id
(sys_user_group) values for an on-call schedule. Use in conjunction with OCRotationV2 -
getSpans.
{#r_OCRotation-setGroupIDs_String__table_zkc_kbb_h5__entry__3}

| Name | Type | Description |
|-|-|-|
| groupIds | String | Comma separated list of group sys_id (sys_user_group) values for an on-call schedule. |
[Table 21. Parameters]

{#r_OCRotation-setGroupIDs_String__table_zkc_kbb_h5} {#r_OCRotation-setGroupIDs_String__table_alc_kbb_h5__entry__2}

| Type | Description |
|-|-|
| Void |   |
[Table 22. Returns]

{#r_OCRotation-setGroupIDs_String__table_alc_kbb_h5}
**Related reference**   

* [OCRotationV2 - getSpans()](https://servicenow-prod.fluidtopics.net/8K0SozSVYQarByNcG9K65w#r_OCRotationV2-getSpans "Get the spans from the specified start date to the specified end date. If no start and end dates are provided, the start date defaults to a month before and the end date defaults to a month after the current time. You can also use the groups IDs, rota IDs, roster IDs, user IDs to further filter the spans.")

## OCRotation - setRosterIds(String rosterIds) {#ariaid-title13}

Sets the rosters according to the selected rotas. Use in conjunction with OCRotationV2
- getSpans.
{#r_OCRotation-setRosterIDs_String__table_ljr_mcb_h5__entry__3}

| Name | Type | Description |
|-|-|-|
| RosterIds | String | Rosters according to the selected rotas. |
[Table 23. Parameters]

{#r_OCRotation-setRosterIDs_String__table_ljr_mcb_h5} {#r_OCRotation-setRosterIDs_String__table_mjr_mcb_h5__entry__2}

| Type | Description |
|-|-|
| void |   |
[Table 24. Returns]

{#r_OCRotation-setRosterIDs_String__table_mjr_mcb_h5}
**Related reference**   

* [OCRotationV2 - getSpans()](https://servicenow-prod.fluidtopics.net/8K0SozSVYQarByNcG9K65w#r_OCRotationV2-getSpans "Get the spans from the specified start date to the specified end date. If no start and end dates are provided, the start date defaults to a month before and the end date defaults to a month after the current time. You can also use the groups IDs, rota IDs, roster IDs, user IDs to further filter the spans.")

## OCRotation - setRotaIds(String rotaIds) {#ariaid-title14}

Sets the rotas for the groups on your calendar. Use in conjunction with OCRotationV2 -
getSpans.
{#r_OCRotation-setRotaIDs_String__table_gvw_zbb_h5__entry__3}

| Name | Type | Description |
|-|-|-|
| RotaIds | String | Rotas for the groups on your calendar. |
[Table 25. Parameters]

{#r_OCRotation-setRotaIDs_String__table_gvw_zbb_h5} {#r_OCRotation-setRotaIDs_String__table_hvw_zbb_h5__entry__2}

| Type | Description |
|-|-|
| Void |   |
[Table 26. Returns]

{#r_OCRotation-setRotaIDs_String__table_hvw_zbb_h5}
**Related reference**   

* [OCRotationV2 - getSpans()](https://servicenow-prod.fluidtopics.net/8K0SozSVYQarByNcG9K65w#r_OCRotationV2-getSpans "Get the spans from the specified start date to the specified end date. If no start and end dates are provided, the start date defaults to a month before and the end date defaults to a month after the current time. You can also use the groups IDs, rota IDs, roster IDs, user IDs to further filter the spans.")

## OCRotation - setStartDate(String startDate) {#ariaid-title15}

Sets the start date for the time period for which you want to retrieve on-call
coverage. If the start date is not set, then the first day of the previous month is applied by
default. Use in conjunction with OCRotationV2 - getSpans.
{#r_OCRotation-setStartDate_String__table_ivn_bjx_g5__entry__3}

| Name | Type | Description |
|-|-|-|
| startDate | String | \[Optional\] Start date for the time period for which you want to retrieve on-call coverage. |
[Table 27. Parameters]

{#r_OCRotation-setStartDate_String__table_ivn_bjx_g5} {#r_OCRotation-setStartDate_String__table_jvn_bjx_g5__entry__2}

| Type | Description |
|-|-|
| void |   |
[Table 28. Returns]

{#r_OCRotation-setStartDate_String__table_jvn_bjx_g5}
**Related reference**   

* [OCRotationV2 - getSpans()](https://servicenow-prod.fluidtopics.net/8K0SozSVYQarByNcG9K65w#r_OCRotationV2-getSpans "Get the spans from the specified start date to the specified end date. If no start and end dates are provided, the start date defaults to a month before and the end date defaults to a month after the current time. You can also use the groups IDs, rota IDs, roster IDs, user IDs to further filter the spans.")

## OCRotation - setTimezone(String timezone) {#ariaid-title16}

Sets the timezone that your on-call calendar will use. Use in conjunction with
OCRotationV2 - getSpans.
{#r_OCRotation-setTimezone_String__table_mpl_3mx_g5__entry__3}

| Name | Type | Description |
|-|-|-|
| Timezone | String | Timezone that your on-call calendar will use. For example, Europe/Madrid and US/Pacific. |
[Table 29. Parameters]

{#r_OCRotation-setTimezone_String__table_mpl_3mx_g5} {#r_OCRotation-setTimezone_String__table_npl_3mx_g5__entry__2}

| Type | Description |
|-|-|
| Void |   |
[Table 30. Returns]

{#r_OCRotation-setTimezone_String__table_npl_3mx_g5}
**Related reference**   

* [OCRotationV2 - getSpans()](https://servicenow-prod.fluidtopics.net/8K0SozSVYQarByNcG9K65w#r_OCRotationV2-getSpans "Get the spans from the specified start date to the specified end date. If no start and end dates are provided, the start date defaults to a month before and the end date defaults to a month after the current time. You can also use the groups IDs, rota IDs, roster IDs, user IDs to further filter the spans.")

## OCRotation - setUserIds(String userIds) {#ariaid-title17}

Sets comma separated list of user sys_id (sys_user) values used to filter on-call
schedules. Use in conjunction with OCRotationV2 - getSpans.
{#r_OCRotation-setUserIDs_String__table_l3f_1db_h5__entry__3}

| Name | Type | Description |
|-|-|-|
| UserIds | String | Comma separated list of user sys_id (sys_user) values used to filter on-call schedules. |
[Table 31. Parameters]

{#r_OCRotation-setUserIDs_String__table_l3f_1db_h5} {#r_OCRotation-setUserIDs_String__table_m3f_1db_h5__entry__2}

| Type | Description |
|-|-|
| Void |   |
[Table 32. Returns]

{#r_OCRotation-setUserIDs_String__table_m3f_1db_h5}
**Related reference**   

* [OCRotationV2 - getSpans()](https://servicenow-prod.fluidtopics.net/8K0SozSVYQarByNcG9K65w#r_OCRotationV2-getSpans "Get the spans from the specified start date to the specified end date. If no start and end dates are provided, the start date defaults to a month before and the end date defaults to a month after the current time. You can also use the groups IDs, rota IDs, roster IDs, user IDs to further filter the spans.")

