Where to use getRecDates

I need to record the individual events of a recurring scheduled event into a separate table but I am having issues.

  1. I understand that I need to use onAfterLightbox event since using it on save will not return all events. The problem is, how do I get the ID to pass to getRecDates from this function?
  2. I don’t see the db calls that the normal save uses? Where is it? I will need to use it as a model to save the individual events to another table.

(1) try to use onEventAdded, onEventChanged ( you can use onAfterLightbox, but in that moment there is no info about event id, so you will need to use one more handler just to save event id )

(2) sorry, but I’m not fully understand your question, can you specify some more details.

  1. So, create a global variable outside of the function, have onEventSave save the id to the global variable. Then, use that in the onAfterLightbox?

  2. I know that fields on the form are mapped to fields in the DB but there must be a spot where the save is executed? What I am wanting to do is extract the recurring start-end dates and save them to another table. Right now, the rec_type field encodes the recurring values but here is what I need to do. We have 2 types of scheduled events (A & B). If we have a day with A scheduled and also B scheduled, we need to save that in a special table. My idea is that if I can extract all of the dates from the rec_type value and store them in a list with each date listed separately I can do the comparison I need and record those days with both events scheduled… unless there is a built in process for this.

(1) yes

(2)
If you are using dataprocessor (default logic of scheduler) you can catch onBeforeDataSending event, which will provide the data object as 3-rd parameter, that object contains all info which will be sent to server ( if you will add something - it will be send as well )

In that point you can get id of record from data object and use scheduler.getRecDates to get the array of objects, with start and end dates for instances of recurring event. You can build a string from that values and store it in some property of data object, so it will be available on the server side.

You may have problems with recuring events without end date, which will produce infinity list of event instances.

Also, if you are using php - there is php helper class which can decode recuring event info and produce full list of event instances.