A time slot represents a period in a day when an appointment can be scheduled.
-
Create a page to show the available time slots for the resource associated with the appointment.
-
Make a POST request on the
getAppointmentSlotsREST API by passing the requiredworkTypeGroupIdorworkTypeIdparameter along with the .territoryIdparameter.Resource URI
https://yourInstance.salesforce.com/services/data/v68.0/scheduling/getAppointmentSlotsSample Request
Using the
WorkTypeIdparameter.{ "workType": { "id": "08qS70000004DQsIAM" }, "territoryIds": [ "0HhS700000001DYKAY" ], "requiredResourceIds": [ "0HnS700000002jAKAQ" ], "accountId": "001S7000001pFlJIAU", "schedulingPolicyId": "2F0VrRM0000004CUV", "engagementChannelTypeIds": [ "0eFS70000004CGFMA2" ] }Using the
WorkTypeGroupIdparameter.{ "workTypeGroupId": "0VS2x0000008ZotGAE", "accountId": "001S7000001pFlJIAU", "schedulingPolicyId": "2F0VrRM0000004CUV", "territoryIds": [ "0HhS700000001DYKAY" ], "requiredResourceIds": [ "0HnS700000002jAKAQ" ], "engagementChannelTypeIds": [ "0eFS70000004CGFMA2" ] }Sample Response
The API returns the available time slots for a resource.
{ "timeSlots" : [ { "endTime" : "2023-03-26T17:55:00.000+0000", "remainingAppointments" : 1, "startTime" : "2023-03-26T17:30:00.000+0000", "territoryId" : "0HhS700000001DYKAY" }, { "endTime" : "2023-03-30T16:55:00.000+0000", "remainingAppointments" : 1, "startTime" : "2023-03-30T16:30:00.000+0000", "territoryId" : "0HhS700000001DYKAY" }, { "endTime" : "2023-04-02T16:55:00.000+0000", "remainingAppointments" : 1, "startTime" : "2023-04-02T16:30:00.000+0000", "territoryId" : "0HhS700000001DYKAY" }, { "endTime" : "2023-04-04T18:25:00.000+0000", "remainingAppointments" : 1, "startTime" : "2023-04-04T18:00:00.000+0000", "territoryId" : "0HhS700000001DYKAY" } ] } -
Parse the JSON response, and show the available time slots on the page.
Your users can select a time slot for the appointment from the page.