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

OCRotaICalendarSNC - cleanExpiredCache ()

Records in the cmn_rota_resp_cache table that have a From date prior to today.

Table 1. Parameters
Name Type Description
None
Table 2. Returns
Type Description
void

OCRotaICalendarSNC - createCalendarEvents (String groupId, String rotaId, String userId, Object dateRangeObj)

Returns list of AJAXScheduleItems for the user's on-call.

Table 4. Returns
Type Description
AJAXScheduleItem Java list of AJAXScheduleItems.

OCRotaICalendarSNC - createCustomEvent (String groupName, Object scheduleItemSpan, String calendarLink)

Creates a VEVENT based on the scheduleItemSpan provided.

Table 5. Parameters
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 6. Returns
Type Description
String A VEVENT based on the scheduleItemSpan provided.

OCRotaICalendarSNC - createPlaceholderCalendar (GlideRecord rotaGR, Object dateRangeObj, String calendarLink)

Creates a formatted iCalendar if the user has no upcoming on-call.

Table 7. Parameters
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 8. Returns
Type Description
String Formatted iCalendar with a placeholder VEVENT.

OCRotaICalendarSNC - getCalendarEvents (String groupId , String rotaId, String userId , Object dateRangeObj, Boolean useCache)

Returns the formatted iCalendar for the user's rotation.

Table 10. Returns
Type Description
String Formatted iCalendar for the user's rotation.

OCRotaICalendarSNC - getEventsFromTable (String groupId, String rotaId, String userId, Object dateRangeObj)

Returns the formatted iCalendar for the user's rotation if found in the cmn_rota_resp_cache table.

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

OCRotaICalendarSNC - getIntersectRotaSpanItem (ScheduleTimeSpan timeSpan, Array rotaSpanItems)

Checks whether the provided timeSpan intersects with one of the rota span items.

Table 13. Parameters
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 14. Returns
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.

OCRotaICalendarSNC - getMemberCalendarURL (String groupId, Object rotaId, String userId)

Creates the subscribable URL for the user's iCalendar.

Table 15. Parameters
Name Type Description
groupId String The group sys id.
rotaId Object The rota sys id.
userId String The user sys id.
Table 16. Returns
Type Description
String The subscribable URL for the user's iCalendar.

OCRotaICalendarSNC - getOnCallCalendarURL (GlideRecord rotaGR)

Returns a URL to the on-call calendar based on the rota record.

Table 17. Parameters
Name Type Description
rotaGR GlideRecord A cmn_rota record.
Table 18. Returns
Type Description
String URL to the on-call calendar based on the rota record.

OCRotaICalendarSNC - handleOverrideMember (AJAXScheduleItem scheduleItem)

Returns an array of the user's overrides (extra coverage).

Table 19. Parameters
Name Type Description
scheduleItem AJAXScheduleItem A list of AJAXScheduleItems.
Table 20. Returns
Type Description
Array An array of the user's overrides (extra coverage).

OCRotaICalendarSNC - handleRotaMember (AjaxSchedueItem scheduleItem , Object rotaSpanItems, Object definitionItems, Array repeatRotaSpanIdArr)

Returns an object containing the user's override (extra coverage) and excluded spans.

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

OCRotaICalendarSNC - invalidateRotaRespCache (GlideRecord rotaRespCacheGR)

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.

Table 23. Parameters
Name Type Description
rotaRespCacheGR GlideRecord Record that has been updated.
Table 24. Returns
Type Description
void

OCRotaICalendarSNC - matchRotaSpanRule(ScheduleTimeSpan timeSpan, Array rotaSpanItems, Array repeatRotaSpanIdArr, Object seriesStartTimes)

Checks whether the provided timeSpan matches one of the rotaSpanItems.

Table 26. Returns
Type Description
Boolean Returns true if the timeSpan matches one of the rotaSpanItems.

OCRotaICalendarSNC - populateCalendarSubscriptionSettings ()

Used by fixed job to populate the calendar subscription fields on the cmn_rota form

Table 27. Parameters
Name Type Description
None
Table 28. Returns
Type Description
void

OCRotaICalendarSNC - processSeriesEvent (List scheduleItems, Array repeatRotaSpanIdArr , String userId)

Returns an object containing the user's rotations.

Table 29. Parameters
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 30. Returns
Type Description
Object Contains the user's rotations.

OCRotaICalendarSNC - saveCalendarEvents (String groupId, String rotaId, String userId, Object dateRangeObj, String result)

Inserts the user's iCalendar into the cmn_rota_resp_cache table.

Table 32. Returns
Type Description
void

OCRotaICalendarSNC - sendCalendarURL (GlideRecord rotaGR)

Queues events to send an email to all members of the rotation.

Table 33. Parameters
Name Type Description
rotaGR GlideRecord A cmn_rota record.
Table 34. Returns
Type Description
void

OCRotaICalendarSNC - updateExceptionList (AJAXScheduleItem scheduleItem, ScheduleTimeSpan timeSpan, Array rotaSpanItems)

Returns an object that contains all of the timeSpans that need to be excluded from the user's iCalendar.

Table 35. Parameters
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 36. Returns
Type Description
Object Object that contains all of the timeSpans that need to be excluded from the user's iCalendar.