{"revision":"c10276e953456835cdbb1f3a60d58ae1980be353","document":{"id":1077,"path":"api-reference/server-api-reference/c_OCRotaICalendarSNCAPI.md","title":"OCRotaICalendarSNC - Global","bundle":null,"doc_type":null,"release":"australia","body":"\n# OCRotaICalendarSNC- Global\n\nThe OCRotaICalendarSNC script include provides iCal formatted events for the a specific user's rotation.\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## OCRotaICalendarSNC - cleanExpiredCache \\(\\)\n\nRecords in the cmn\\_rota\\_resp\\_cache table that have a From date prior to today.\n\n|Name|Type|Description|\n|----|----|-----------|\n|None| | |\n\n|Type|Description|\n|----|-----------|\n|void| |\n\n## OCRotaICalendarSNC - createCalendarEvents \\(String groupId, String rotaId, String userId, Object dateRangeObj\\)\n\nReturns list of AJAXScheduleItems for the user's on-call.\n\n|Name|Type|Description|\n|----|----|-----------|\n|groupId|String|The group sys id.|\n|rotaId|String|The rota sys id.|\n|userId|String|The user sys id.|\n|dateRangeObj|Object|Contains the from and to dates for the data set.|\n\n|Type|Description|\n|----|-----------|\n|AJAXScheduleItem|Java list of AJAXScheduleItems.|\n\n## OCRotaICalendarSNC - createCustomEvent \\(String groupName, Object scheduleItemSpan, String calendarLink\\)\n\nCreates a VEVENT based on the scheduleItemSpan provided.\n\n|Name|Type|Description|\n|----|----|-----------|\n|groupName|String|Name of the on-call group.|\n|scheduleItemSpan|Object|Span of time for the on-call period.|\n|calendarLink|String|A link back to the on-call calendar in the instance.|\n\n|Type|Description|\n|----|-----------|\n|String|A VEVENT based on the scheduleItemSpan provided.|\n\n## OCRotaICalendarSNC - createPlaceholderCalendar \\(GlideRecord rotaGR, Object dateRangeObj, String calendarLink\\)\n\nCreates a formatted iCalendar if the user has no upcoming on-call.\n\n|Name|Type|Description|\n|----|----|-----------|\n|rotaGR|GlideRecord|The cmn\\_rota glide record.|\n|dateRangeObj|Object|Contains the from and to dates for the data set.|\n|calendarLink|String|A link to the on-call calendar for this user.|\n\n|Type|Description|\n|----|-----------|\n|String|Formatted iCalendar with a placeholder VEVENT.|\n\n## OCRotaICalendarSNC - getCalendarEvents \\(String groupId , String rotaId, String userId , Object dateRangeObj, Boolean useCache\\)\n\nReturns the formatted iCalendar for the user's rotation.\n\n|Name|Type|Description|\n|----|----|-----------|\n|groupId|String|The group sys id.|\n|rotaId|String|The rota sys id.|\n|userId|String|The user sys id.|\n|dateRangeObj|Object|Contains the from and to dates for the data set.|\n|useCache|Boolean|If true, makes use of the cache table cmn\\_rota\\_resp\\_cache.|\n\n|Type|Description|\n|----|-----------|\n|String|Formatted iCalendar for the user's rotation.|\n\n## OCRotaICalendarSNC - getEventsFromTable \\(String groupId, String rotaId, String userId, Object dateRangeObj\\)\n\nReturns the formatted iCalendar for the user's rotation if found in the cmn\\_rota\\_resp\\_cache table.\n\n|Name|Type|Description|\n|----|----|-----------|\n|groupId|String|The group sys id.|\n|rotaId|String|The rota sys id.|\n|userId|String|The user sys id.|\n|dateRangeObj|Object|Contains the from and to dates for the data set.|\n\n|Type|Description|\n|----|-----------|\n|String|Formatted iCalendar for the user's rotation if found in the cmn\\_rota\\_resp\\_cache table.|\n\n## OCRotaICalendarSNC - getIntersectRotaSpanItem \\(ScheduleTimeSpan timeSpan, Array rotaSpanItems\\)\n\nChecks whether the provided timeSpan intersects with one of the rota span items.\n\n|Name|Type|Description|\n|----|----|-----------|\n|timeSpan|ScheduleTimeSpan|A single span for the user's on-call.|\n|rotaSpanItems|Array|Contains the user's standard on-call spans.|\n\n|Type|Description|\n|----|-----------|\n|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.|\n\n## OCRotaICalendarSNC - getMemberCalendarURL \\(String groupId, Object rotaId, String userId\\)\n\nCreates the subscribable URL for the user's iCalendar.\n\n|Name|Type|Description|\n|----|----|-----------|\n|groupId|String|The group sys id.|\n|rotaId|Object|The rota sys id.|\n|userId|String|The user sys id.|\n\n|Type|Description|\n|----|-----------|\n|String|The subscribable URL for the user's iCalendar.|\n\n## OCRotaICalendarSNC - getOnCallCalendarURL \\(GlideRecord rotaGR\\)\n\nReturns a URL to the on-call calendar based on the rota record.\n\n|Name|Type|Description|\n|----|----|-----------|\n|rotaGR|GlideRecord|A cmn\\_rota record.|\n\n|Type|Description|\n|----|-----------|\n|String|URL to the on-call calendar based on the rota record.|\n\n## OCRotaICalendarSNC - handleOverrideMember \\(AJAXScheduleItem scheduleItem\\)\n\nReturns an array of the user's overrides \\(extra coverage\\).\n\n|Name|Type|Description|\n|----|----|-----------|\n|scheduleItem|AJAXScheduleItem|A list of AJAXScheduleItems.|\n\n|Type|Description|\n|----|-----------|\n|Array|An array of the user's overrides \\(extra coverage\\).|\n\n## OCRotaICalendarSNC - handleRotaMember \\(AjaxSchedueItem scheduleItem , Object rotaSpanItems, Object definitionItems, Array repeatRotaSpanIdArr\\)\n\nReturns an object containing the user's override \\(extra coverage\\) and excluded spans.\n\n|Name|Type|Description|\n|----|----|-----------|\n|scheduleItem|AJAXSchedueItem|A list of AJAXScheduleItems.|\n|rotaSpanItems|Object|Contains the user's standard on-call spans.|\n|definitionItems|Object|Contains the rota's standard on-call spans.|\n|repeatRotaSpanIdArr|Array|An array of rota span sys ids.|\n\n|Type|Description|\n|----|-----------|\n|Object|Contains the user's override \\(extra coverage\\) and excluded spans.|\n\n## OCRotaICalendarSNC - invalidateRotaRespCache \\(GlideRecord rotaRespCacheGR\\)\n\nUsed by business rules on the cmn\\_rota\\_member, cmn\\_schedule\\_span, and roster\\_schedule\\_span tables to update the cmn\\_rota\\_resp\\_cache table.\n\n|Name|Type|Description|\n|----|----|-----------|\n|rotaRespCacheGR|GlideRecord|Record that has been updated.|\n\n|Type|Description|\n|----|-----------|\n|void| |\n\n## OCRotaICalendarSNC - matchRotaSpanRule\\(ScheduleTimeSpan timeSpan, Array rotaSpanItems, Array repeatRotaSpanIdArr, Object seriesStartTimes\\)\n\nChecks whether the provided timeSpan matches one of the rotaSpanItems.\n\n|Name|Type|Description|\n|----|----|-----------|\n|timeSpan|ScheduleTimeSpan|A single span for the user's on-call.|\n|rotaSpanItems|Array|Contains the user's standard on-call spans.|\n|repeatRotaSpanIdArr|Array|An array of rota span sys ids.|\n|seriesStartTimes|Object|Start time of the rota spans.|\n\n|Type|Description|\n|----|-----------|\n|Boolean|Returns true if the timeSpan matches one of the rotaSpanItems.|\n\n## OCRotaICalendarSNC - populateCalendarSubscriptionSettings \\(\\)\n\nUsed by fixed job to populate the calendar subscription fields on the cmn\\_rota form\n\n|Name|Type|Description|\n|----|----|-----------|\n|None| | |\n\n|Type|Description|\n|----|-----------|\n|void| |\n\n## OCRotaICalendarSNC - processSeriesEvent \\(List scheduleItems, Array repeatRotaSpanIdArr , String userId\\)\n\nReturns an object containing the user's rotations.\n\n|Name|Type|Description|\n|----|----|-----------|\n|scheduleItems|List|The user's on-call rotation as an AJAXScheduleItem list.|\n|repeatRotaSpanIdArr|Array|An array of the cmn\\_rota schedule span record sys\\_ids.|\n|userId|String|The user sys id.|\n\n|Type|Description|\n|----|-----------|\n|Object|Contains the user's rotations.|\n\n## OCRotaICalendarSNC - saveCalendarEvents \\(String groupId, String rotaId, String userId, Object dateRangeObj, String result\\)\n\nInserts the user's iCalendar into the cmn\\_rota\\_resp\\_cache table.\n\n|Name|Type|Description|\n|----|----|-----------|\n|groupId|String|The group sys id.|\n|rotaId|String|The rota sys id.|\n|userId|String|The user sys id.|\n|dateRangeObj|Object|Contains the from and to dates for the data set.|\n|result|String|The user's iCalendar.|\n\n|Type|Description|\n|----|-----------|\n|void| |\n\n## OCRotaICalendarSNC - sendCalendarURL \\(GlideRecord rotaGR\\)\n\nQueues events to send an email to all members of the rotation.\n\n|Name|Type|Description|\n|----|----|-----------|\n|rotaGR|GlideRecord|A cmn\\_rota record.|\n\n|Type|Description|\n|----|-----------|\n|void| |\n\n## OCRotaICalendarSNC - updateExceptionList \\(AJAXScheduleItem scheduleItem, ScheduleTimeSpan timeSpan, Array rotaSpanItems\\)\n\nReturns an object that contains all of the timeSpans that need to be excluded from the user's iCalendar.\n\n|Name|Type|Description|\n|----|----|-----------|\n|scheduleItem|AJAXScheduleItem|One AJAXScheduleItem.|\n|timeSpan|ScheduleTimeSpan|A single user's standard on-call span.|\n|rotaSpanItems|Array|Contains the user's standard on-call spans.|\n\n|Type|Description|\n|----|-----------|\n|Object|Object that contains all of the timeSpans that need to be excluded from the user's iCalendar.|\n\n"}}