Newer Version Available
ServiceResourceScheduleHandler Interface
Allows an implementing class to check external calendar events to find
already booked time slots for the requested service resources. This interface is part of
Lightning Scheduler.
Namespace
Usage
The lxscheduler.ServiceResourceScheduleHandler interface is called by Lightning Scheduler APIs.
To implement this interface, you must first declare a class with the implements keyword as follows:
1public class ServiceResourceScheduleHandlerImpl implements LxScheduler.ServiceResourceScheduleHandler{}Next, your class must provide an implementation for the following method:
1public static List<LxScheduler.ServiceResourceSchedule> getUnavailableTimeslots(LxScheduler.ServiceAppointmentRequestInfo requestInfo){
2 //Your code here
3}The implemented method must be declared as global or public.
ServiceResourceScheduleHandler Methods
The following are methods for ServiceResourceScheduleHandler.
ServiceResourceScheduleHandler Example Implementation
This is an example implementation of the lxscheduler.ServiceResourceScheduleHandler interface.
1/**
2 * Implement interface lxscheduler.ServiceResourceScheduleHandler
3 * This class is called when fetching service resources and time slots through Lightning Scheduler API.*/
4 Public class ServiceResourceScheduleHandlerImpl implements lxscheduler.ServiceResourceScheduleHandler.{
5
6 // The main interface method.
7 public static List<lxscheduler.ServiceResourceSchedule> getUnavailableTimeslots(lxscheduler.ServiceAppointmentRequestInfo requestInfo){
8 //Request info values.
9 List<lxscheduler.ServiceResourceInfo> serviceResources=requestInfo.getServiceResources();
10 DateTime startDate=requestInfo.getStartDate();
11 DateTime endDate=requestInfo.getEndDate();
12
13
14 List<lxscheduler.ServiceResourceSchedule> resourceUnavailability = new List<lxscheduler.ServiceResourceSchedule>();
15 Set<lxscheduler.UnavailableTimeslot> unavailabilityIntervals = new Set<lxscheduler.UnavailableTimeslot>();
16
17 //This is a dummy response. Implement your own business logic to connect to your internal or external systems.
18 for (Integer i = 0; i < 5; i++) {
19 //Set the unavailability intervals of a service resource.
20 unavailabilityIntervals.add(new lxscheduler.UnavailableTimeslot(startDate.addMinutes(15*i),startDate.addMinutes(15*(i+1))));
21 }
22
23 for (lxscheduler.ServiceResourceInfo ServiceResource:serviceResources) {
24 //Set the unavailability of Service resource.
25 resourceUnavailability.add(new lxscheduler.ServiceResourceSchedule(serviceResource.getServiceResourceId(),unavailabilityIntervals));
26
27 }
28
29 return resourceUnavailability;
30 }
31}