---
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


---

# OCRotaICalendarSNC - Global

# OCRotaICalendarSNC - Global {#ariaid-title1}

The OCRotaICalendarSNC script include provides iCal formatted events for the a specific user's rotation.

## OCRotaICalendarSNC - cleanExpiredCache () {#ariaid-title2}

Records in the cmn_rota_resp_cache table that have a From date prior to
today.
{#r_OCRICalSNC-cleanExpiredCache__table_a4p_3l3_hx__entry__3}

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

{#r_OCRICalSNC-cleanExpiredCache__table_a4p_3l3_hx} {#r_OCRICalSNC-cleanExpiredCache__table_b4p_3l3_hx__entry__2}

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

{#r_OCRICalSNC-cleanExpiredCache__table_b4p_3l3_hx}

## OCRotaICalendarSNC - createCalendarEvents (String groupId, String rotaId, String userId,
Object dateRangeObj) {#ariaid-title3}

Returns list of AJAXScheduleItems for the user's on-call.
{#r_OCRICalSNC-createCalEvent_S_S_S_O__table_cbl_mtg_hx__entry__3}

| Name | Type | Description |
|-|-|-|
| groupId | String | The group sys id. |
| rotaId | String | The rota sys id. |
| userId | String | The user sys id. |
| dateRangeObj | Object | Contains the from and to dates for the data set. |
[Table 3. Parameters]

{#r_OCRICalSNC-createCalEvent_S_S_S_O__table_cbl_mtg_hx} {#r_OCRICalSNC-createCalEvent_S_S_S_O__table_dbl_mtg_hx__entry__2}

| Type | Description |
|-|-|
| AJAXScheduleItem | Java list of AJAXScheduleItems. |
[Table 4. Returns]

{#r_OCRICalSNC-createCalEvent_S_S_S_O__table_dbl_mtg_hx}

## OCRotaICalendarSNC - createCustomEvent (String groupName, Object scheduleItemSpan, String
calendarLink) {#ariaid-title4}

Creates a VEVENT based on the scheduleItemSpan provided.
{#r_OCRICalSNC-createCustomEvnt_S_O_S__table_xqv_s33_hx__entry__3}

| Name | Type | Description |
|-|-|-|
| groupName | String | Name of the on-call group. |
| scheduleItemSpan | Object | Span of time for the on-call period. |
| calendarLink | String | A link back to the on-call calendar in the instance. |
[Table 5. Parameters]

{#r_OCRICalSNC-createCustomEvnt_S_O_S__table_xqv_s33_hx} {#r_OCRICalSNC-createCustomEvnt_S_O_S__table_yqv_s33_hx__entry__2}

| Type | Description |
|-|-|
| String | A VEVENT based on the scheduleItemSpan provided. |
[Table 6. Returns]

{#r_OCRICalSNC-createCustomEvnt_S_O_S__table_yqv_s33_hx}

## OCRotaICalendarSNC - createPlaceholderCalendar (GlideRecord rotaGR, Object dateRangeObj,
String calendarLink) {#ariaid-title5}

Creates a formatted iCalendar if the user has no upcoming on-call.
{#r_OCRICalSNC-createPCalendar_GR_O_S__table_zzb_nrg_hx__entry__3}

| Name | Type | Description |
|-|-|-|
| rotaGR | GlideRecord | The cmn_rota glide record. |
| dateRangeObj | Object | Contains the from and to dates for the data set. |
| calendarLink | String | A link to the on-call calendar for this user. |
[Table 7. Parameters]

{#r_OCRICalSNC-createPCalendar_GR_O_S__table_zzb_nrg_hx} {#r_OCRICalSNC-createPCalendar_GR_O_S__table_a1c_nrg_hx__entry__2}

| Type | Description |
|-|-|
| String | Formatted iCalendar with a placeholder VEVENT. |
[Table 8. Returns]

{#r_OCRICalSNC-createPCalendar_GR_O_S__table_a1c_nrg_hx}

## OCRotaICalendarSNC - getCalendarEvents (String groupId , String rotaId, String userId ,
Object dateRangeObj, Boolean useCache) {#ariaid-title6}

Returns the formatted iCalendar for the user's rotation.
{#r_OCRICalSNC-gCalendarE_S_S_S_O_B__table_m3t_zpg_hx__entry__3}

| Name | Type | Description |
|-|-|-|
| groupId | String | The group sys id. |
| rotaId | String | The rota sys id. |
| userId | String | The user sys id. |
| dateRangeObj | Object | Contains the from and to dates for the data set. |
| useCache | Boolean | If true, makes use of the cache table cmn_rota_resp_cache. |
[Table 9. Parameters]

{#r_OCRICalSNC-gCalendarE_S_S_S_O_B__table_m3t_zpg_hx} {#r_OCRICalSNC-gCalendarE_S_S_S_O_B__table_n3t_zpg_hx__entry__2}

| Type | Description |
|-|-|
| String | Formatted iCalendar for the user's rotation. |
[Table 10. Returns]

{#r_OCRICalSNC-gCalendarE_S_S_S_O_B__table_n3t_zpg_hx}

## OCRotaICalendarSNC - getEventsFromTable (String groupId, String rotaId, String userId,
Object dateRangeObj) {#ariaid-title7}

Returns the formatted iCalendar for the user's rotation if found in the
cmn_rota_resp_cache table.
{#r_OCRICalSNC-getEventsFTble_S_S_S_O__table_k2m_qsg_hx__entry__3}

| Name | Type | Description |
|-|-|-|
| groupId | String | The group sys id. |
| rotaId | String | The rota sys id. |
| userId | String | The user sys id. |
| dateRangeObj | Object | Contains the from and to dates for the data set. |
[Table 11. Parameters]

{#r_OCRICalSNC-getEventsFTble_S_S_S_O__table_k2m_qsg_hx} {#r_OCRICalSNC-getEventsFTble_S_S_S_O__table_l2m_qsg_hx__entry__2}

| Type | Description |
|-|-|
| String | Formatted iCalendar for the user's rotation if found in the cmn_rota_resp_cache table. |
[Table 12. Returns]

{#r_OCRICalSNC-getEventsFTble_S_S_S_O__table_l2m_qsg_hx}

## OCRotaICalendarSNC - getIntersectRotaSpanItem (ScheduleTimeSpan timeSpan, Array
rotaSpanItems) {#ariaid-title8}

Checks whether the provided timeSpan intersects with one of the rota span
items.
{#r_OCRICalSNC-getIntrRotSpnItm_STS_A__table_ltr_d33_hx__entry__3}

| Name | Type | Description |
|-|-|-|
| timeSpan | ScheduleTimeSpan | A single span for the user's on-call. |
| rotaSpanItems | Array | Contains the user's standard on-call spans. |
[Table 13. Parameters]

{#r_OCRICalSNC-getIntrRotSpnItm_STS_A__table_ltr_d33_hx} {#r_OCRICalSNC-getIntrRotSpnItm_STS_A__table_mtr_d33_hx__entry__2}

| Type | Description |
|-|-|
| Object | If the timeSpan intersects with one of the rota span items, returns an object containing the rota span item and the span that it intersects with. |
[Table 14. Returns]

{#r_OCRICalSNC-getIntrRotSpnItm_STS_A__table_mtr_d33_hx}

## OCRotaICalendarSNC - getMemberCalendarURL (String groupId, Object rotaId, String
userId) {#ariaid-title9}

Creates the subscribable URL for the user's iCalendar.
{#r_OCRICalSNC-getMemCalURL_S_O_S__table_t1c_sn3_hx__entry__3}

| Name | Type | Description |
|-|-|-|
| groupId | String | The group sys id. |
| rotaId | Object | The rota sys id. |
| userId | String | The user sys id. |
[Table 15. Parameters]

{#r_OCRICalSNC-getMemCalURL_S_O_S__table_t1c_sn3_hx} {#r_OCRICalSNC-getMemCalURL_S_O_S__table_u1c_sn3_hx__entry__2}

| Type | Description |
|-|-|
| String | The subscribable URL for the user's iCalendar. |
[Table 16. Returns]

{#r_OCRICalSNC-getMemCalURL_S_O_S__table_u1c_sn3_hx}

## OCRotaICalendarSNC - getOnCallCalendarURL (GlideRecord rotaGR) {#ariaid-title10}

Returns a URL to the on-call calendar based on the rota record.
{#r_OCRICalSNC-getOnCallCalURL_GR__table_ytj_ql3_hx__entry__3}

| Name | Type | Description |
|-|-|-|
| rotaGR | GlideRecord | A cmn_rota record. |
[Table 17. Parameters]

{#r_OCRICalSNC-getOnCallCalURL_GR__table_ytj_ql3_hx} {#r_OCRICalSNC-getOnCallCalURL_GR__table_ztj_ql3_hx__entry__2}

| Type | Description |
|-|-|
| String | URL to the on-call calendar based on the rota record. |
[Table 18. Returns]

{#r_OCRICalSNC-getOnCallCalURL_GR__table_ztj_ql3_hx}

## OCRotaICalendarSNC - handleOverrideMember (AJAXScheduleItem scheduleItem) {#ariaid-title11}

Returns an array of the user's overrides (extra coverage).
{#r_OCRICalSNC-handleOverrideMem_ASI__table_lvd_zxg_hx__entry__3}

| Name | Type | Description |
|-|-|-|
| scheduleItem | AJAXScheduleItem | A list of AJAXScheduleItems. |
[Table 19. Parameters]

{#r_OCRICalSNC-handleOverrideMem_ASI__table_lvd_zxg_hx} {#r_OCRICalSNC-handleOverrideMem_ASI__table_mvd_zxg_hx__entry__2}

| Type | Description |
|-|-|
| Array | An array of the user's overrides (extra coverage). |
[Table 20. Returns]

{#r_OCRICalSNC-handleOverrideMem_ASI__table_mvd_zxg_hx}

## OCRotaICalendarSNC - handleRotaMember (AjaxSchedueItem scheduleItem , Object rotaSpanItems,
Object definitionItems, Array repeatRotaSpanIdArr) {#ariaid-title12}

Returns an object containing the user's override (extra coverage) and excluded
spans.
{#r_OCRICalSNC-handleRotMem_Aj_O_O_A__table_kdm_wwg_hx__entry__3}

| Name | Type | Description |
|-|-|-|
| scheduleItem | AJAXSchedueItem | A list of AJAXScheduleItems. |
| rotaSpanItems | Object | Contains the user's standard on-call spans. |
| definitionItems | Object | Contains the rota's standard on-call spans. |
| repeatRotaSpanIdArr | Array | An array of rota span sys ids. |
[Table 21. Parameters]

{#r_OCRICalSNC-handleRotMem_Aj_O_O_A__table_kdm_wwg_hx} {#r_OCRICalSNC-handleRotMem_Aj_O_O_A__table_ldm_wwg_hx__entry__2}

| Type | Description |
|-|-|
| Object | Contains the user's override (extra coverage) and excluded spans. |
[Table 22. Returns]

{#r_OCRICalSNC-handleRotMem_Aj_O_O_A__table_ldm_wwg_hx}

## OCRotaICalendarSNC - invalidateRotaRespCache (GlideRecord rotaRespCacheGR) {#ariaid-title13}

Used by business rules on the cmn_rota_member, cmn_schedule_span, and roster_schedule_span tables to update the cmn_rota_resp_cache table.
{#r_OCRICalSNC-invalRotaRespCache_GR__table_uzk_wk3_hx__entry__3}

| Name | Type | Description |
|-|-|-|
| rotaRespCacheGR | GlideRecord | Record that has been updated. |
[Table 23. Parameters]

{#r_OCRICalSNC-invalRotaRespCache_GR__table_uzk_wk3_hx} {#r_OCRICalSNC-invalRotaRespCache_GR__table_vzk_wk3_hx__entry__2}

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

{#r_OCRICalSNC-invalRotaRespCache_GR__table_vzk_wk3_hx}

## OCRotaICalendarSNC - matchRotaSpanRule(ScheduleTimeSpan timeSpan, Array rotaSpanItems,
Array repeatRotaSpanIdArr, Object seriesStartTimes) {#ariaid-title14}

Checks whether the provided timeSpan matches one of the rotaSpanItems.
{#r_OCRICalSNC-mthRotSpnRul_STS_A_A_O__table_zcb_syg_hx__entry__3}

| Name | Type | Description |
|-|-|-|
| timeSpan | ScheduleTimeSpan | A single span for the user's on-call. |
| rotaSpanItems | Array | Contains the user's standard on-call spans. |
| repeatRotaSpanIdArr | Array | An array of rota span sys ids. |
| seriesStartTimes | Object | Start time of the rota spans. |
[Table 25. Parameters]

{#r_OCRICalSNC-mthRotSpnRul_STS_A_A_O__table_zcb_syg_hx} {#r_OCRICalSNC-mthRotSpnRul_STS_A_A_O__table_adb_syg_hx__entry__2}

| Type | Description |
|-|-|
| Boolean | Returns true if the timeSpan matches one of the rotaSpanItems. |
[Table 26. Returns]

{#r_OCRICalSNC-mthRotSpnRul_STS_A_A_O__table_adb_syg_hx}

## OCRotaICalendarSNC - populateCalendarSubscriptionSettings () {#ariaid-title15}

Used by fixed job to populate the calendar subscription fields on the cmn_rota
form
{#r_OCRICalSNC-populateCalSubsSetting__table_y5h_p43_hx__entry__3}

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

{#r_OCRICalSNC-populateCalSubsSetting__table_y5h_p43_hx} {#r_OCRICalSNC-populateCalSubsSetting__table_z5h_p43_hx__entry__2}

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

{#r_OCRICalSNC-populateCalSubsSetting__table_z5h_p43_hx}

## OCRotaICalendarSNC - processSeriesEvent (List scheduleItems, Array repeatRotaSpanIdArr ,
String userId) {#ariaid-title16}

Returns an object containing the user's rotations.
{#r_OCRICalSNC-procesSeriesEvnt_L_A_S__table_y4m_yvg_hx__entry__3}

| Name | Type | Description |
|-|-|-|
| scheduleItems | List | The user's on-call rotation as an AJAXScheduleItem list. |
| repeatRotaSpanIdArr | Array | An array of the cmn_rota schedule span record sys_ids. |
| userId | String | The user sys id. |
[Table 29. Parameters]

{#r_OCRICalSNC-procesSeriesEvnt_L_A_S__table_y4m_yvg_hx} {#r_OCRICalSNC-procesSeriesEvnt_L_A_S__table_z4m_yvg_hx__entry__2}

| Type | Description |
|-|-|
| Object | Contains the user's rotations. |
[Table 30. Returns]

{#r_OCRICalSNC-procesSeriesEvnt_L_A_S__table_z4m_yvg_hx}

## OCRotaICalendarSNC - saveCalendarEvents (String groupId, String rotaId, String userId,
Object dateRangeObj, String result) {#ariaid-title17}

Inserts the user's iCalendar into the cmn_rota_resp_cache table.
{#r_OCRICalSNC-saveCalEvnts_S_S_S_O_S__table_z4x_fk3_hx__entry__3}

| Name | Type | Description |
|-|-|-|
| groupId | String | The group sys id. |
| rotaId | String | The rota sys id. |
| userId | String | The user sys id. |
| dateRangeObj | Object | Contains the from and to dates for the data set. |
| result | String | The user's iCalendar. |
[Table 31. Parameters]

{#r_OCRICalSNC-saveCalEvnts_S_S_S_O_S__table_z4x_fk3_hx} {#r_OCRICalSNC-saveCalEvnts_S_S_S_O_S__table_apx_fk3_hx__entry__2}

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

{#r_OCRICalSNC-saveCalEvnts_S_S_S_O_S__table_apx_fk3_hx}

## OCRotaICalendarSNC - sendCalendarURL (GlideRecord rotaGR) {#ariaid-title18}

Queues events to send an email to all members of the rotation.
{#r_OCRICalSNC-sendCalendarURL_GR__table_zhc_f43_hx__entry__3}

| Name | Type | Description |
|-|-|-|
| rotaGR | GlideRecord | A cmn_rota record. |
[Table 33. Parameters]

{#r_OCRICalSNC-sendCalendarURL_GR__table_zhc_f43_hx} {#r_OCRICalSNC-sendCalendarURL_GR__table_a3c_f43_hx__entry__2}

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

{#r_OCRICalSNC-sendCalendarURL_GR__table_a3c_f43_hx}

## OCRotaICalendarSNC - updateExceptionList (AJAXScheduleItem scheduleItem, ScheduleTimeSpan
timeSpan, Array rotaSpanItems) {#ariaid-title19}

Returns an object that contains all of the timeSpans that need to be excluded from the
user's iCalendar.
{#r_OCRICalSNC-updExcptnLst_ASI_STS_A__table_fyt_nj3_hx__entry__3}

| Name | Type | Description |
|-|-|-|
| scheduleItem | AJAXScheduleItem | One AJAXScheduleItem. |
| timeSpan | ScheduleTimeSpan | A single user's standard on-call span. |
| rotaSpanItems | Array | Contains the user's standard on-call spans. |
[Table 35. Parameters]

{#r_OCRICalSNC-updExcptnLst_ASI_STS_A__table_fyt_nj3_hx} {#r_OCRICalSNC-updExcptnLst_ASI_STS_A__table_gyt_nj3_hx__entry__2}

| Type | Description |
|-|-|
| Object | Object that contains all of the timeSpans that need to be excluded from the user's iCalendar. |
[Table 36. Returns]

{#r_OCRICalSNC-updExcptnLst_ASI_STS_A__table_gyt_nj3_hx}

