GradeSlotsService Class
Represents the results shown in the Candidates quick action. Use the GradeSlotsService class to evaluate all possible slots where a given service appointment can be scheduled.
When scheduling a service appointment, the user scheduling the appointment must have one of four managed package permission sets: Field Service Admin, Field Service Dispatcher, Field Service Call Center, Field Service Self-Service. If you’re using platform events to schedule appointments, you must explicitly configure the user so that the user has the correct permissions. Without the proper configuration, the platform event runs as the Automated Process system user and doesn’t have the correct permissions to schedule an appointment. To learn more, see Configure the User and Batch Size for Your Platform Event Trigger.
The following are constructors for GradeSlotsService.
Creates a new instance of the GradeSlotsService class using the specified scheduling policy ID and service appointment ID.
public GradeSlotsService(Id schedulingPolicyId, Id serviceAppointmentId)
- schedulingPolicyId
Type: Id
The record ID of the scheduling policy being used to schedule the service appointment.
- serviceAppointmentId
Type: Id
The record ID of the service appointment being scheduled.
GradeSlotsService includes the following static method.
Returns a matrix of resource IDs and graded time slots. The information is similar to that shown in the Candidates quick action.
public FSL.AdvancedGapMatrix getGradedMatrix(Boolean i_ResultsInUserTimeZone)
- i_ResultsInUserTimeZone
Type: Boolean
If
true, all DateTimes are returned in the user’s time zone. Iffalse, all DateTimes are returned in UTC.
Type: FSL.AdvancedGapMatrix
If Enhanced Scheduling and Optimization (ESO) is enabled, this method runs synchronously. If ESO isn’t enabled, this method can be called with only one service appointment at a time, and runs asynchronously. To examine results that the asynchronous method returns, use the streaming API and subscribe to MstCompletedChannel, the channel for the Field Service managed package.
This example illustrates how to parse the results in the FSL.AdvancedGapMatrix to extract the service resource ID, start and end times, and grade of each slot.