Exception dates in recurring events
Exceptions are occurrences of a recurring event that vary from the originally defined recurrence rule in any way. To give the platform the visibility it needs into recurring event exceptions, the an application builder must do the following:
- Along with each recurring event record, maintain an associated set of records where each record has an exception date for the recurring event. The association string between the records must be Has Recurrence Exception and the field on the associated record must be named triEventExceptionDT. An exception date is the original start time of the occurrence that was modified or deleted from the series.
- At the save of a recurring event, populate the event's triRecurrenceExceptionTX field with the result of the createRecurrenceExDate() function.
At runtime, when createRecurrenceExDate() is called, the event's record ID is passed in. The platform then iterates through the associated records and generates an iCal-compliant EXDATE string representing the start time of each recurring event exception. If the resulting string is greater than 1000 characters, then the platform instead returns a single character, `+'. The plus sign indicates to the platform at runtime that the exception dates for this recurring event cannot be found in the triRecurrenceExceptionTX field. Instead, the platform must query the associated exception date records. The iCal-compliant EXDATE is generated at runtime in this case. This design supports an unlimited number of exception dates.
In terms of application data modeling, the recurring event exception can be the record associated to the recurring event with Has Recurrence Exception. However, this may only be sufficient to model the occurrences of the series that were modified. It is not a good way to model the occurrences of the series that were deleted. To handle those occurrences, use a business object to store just the deleted occurrences. For the purposes of generating an EXDATE, it does not matter what business objects are associated to the recurring event as long as 1) they are associated via the `Has Recurrence Exception association string and 2) the original start time of the occurrence modified or deleted exists in a field named triEventExceptionDT.