...
Code Block |
---|
B25.TimeSlotFinder.Context context = new B25.TimeSlotFinder.Context(); // the time slot context defines what the resulting series of slots should look like context.timeSlotContext = new B25.TimeSlotGenerator.Context(); context.timeSlotContext.startOfRange = System.now(); context.timeSlotContext.endOfRange = System.now().addHours(2); context.timeSlotContext.duration = 60; context.timeSlotContext.interval = 15; // specify all the potential resource ids // NOTE: replace these with resource ids that exist in your org! context.fieldIds = new Map<String, List<Id>>{ 'B25__Resource__c' => new List<Id>{'a0eJX000000hnL7YAI', 'a0eJX000000hnL8YAI'} }; // call the method and do something with the result B25.TimeSlotFinder.Result result = B25.TimeSlotFinder.findTimeSlots(context); for (B25.TimeSlot timeSlot : result.timeSlots) { System.debug('available time slot from ' + timeSlot.startDatetime + ' until ' + timeSlot.endDatetime); B25.TimeSlotWithReservations timeSlotWithReservations = (B25.TimeSlotWithReservations) timeSlot; System.debug(timeSlotWithReservations.reservations); } |
GoMeddo Rest API
In the GoMeddo Rest API, there is a similar function called /timeSlots that displays available timeslots based on a given reservation.