Change Appointment Time Slots

A time slot represents a period in a day when an appointment takes place. a multi-resource service appointment can be modified. To show the alternative tome slots for the assigned resources, use the getAppointmentSlots REST API.

Create a page in your app to show the selected primary resource, other required resources, including assets, and the consolidated time slots for the primary service resource and required resources that users select. Here’s how a page can look.A representation of the manage multiple service resource screen.

When the user selects one or more required resources, refresh the available time slots by making a POST request to the getAppointmentSlots REST API and passing the selected required resources along with the workTypeGroupId and territoryId parameters.

Resource URI
https://yourInstance.salesforce.com/services/data/vXX.X/scheduling/getAppointmentSlots
Sample Request
{
   "startTime" : "2021-10-04T17:00:00.000+0000",
   "endTime" : "2021-10-04T18:00:00.000+0000",
   "workTypeId" : {
       "08qB0000000Tf1FIAS"
   },
   "accountId" : "001B000001McLhMIAV",
   "territoryIds" : ["0HhB0000000TaHOKA0"],
   "primaryResourceId" : "0HnB0000000TavDKAS",
   "requiredResourceIds" : ["0HnB0000000DynTKAS", "0HnB0000000Tav3KAC"]
}
Sample Response

The API returns the time slots where the selected primary resource and required resources are available for the multi-resource service appointment.

{
   "timeSlots" : [ {
      "endTime" : "2021-10-04T18:00:00.000+0000",
      "startTime" : "2021-10-04T17:00:00.000+0000",
      "territoryId" : "0HhB0000000TaHOKA0"
   }, {
      "endTime" : "2021-10-04T19:00:00.000+0000",
      "startTime" : "2021-10-04T17:00:00.000+0000",
      "territoryId" : "0HhB0000000TaHOKA0"
   }, {
      "endTime" : "2021-10-04T20:00:00.000+0000",
      "startTime" : "2021-10-04T17:30:00.000+0000",
      "territoryId" : "0HhB0000000TaHOKA0"
   }, {
      "endTime" : "2021-10-04T18:00:00.000+0000",
      "startTime" : "2021-10-04T17:00:00.000+0000",
      "territoryId" : "0HhB0000000TaHOKA0"
   }, {
      "endTime" : "2021-10-04T18:30:00.000+0000",
      "startTime" : "2021-10-04T17:30:00.000+0000",
      "territoryId" : "0HhB0000000TaHOKA0"
   }, {
      "endTime" : "2021-10-04T18:00:00.000+0000",
      "startTime" : "2021-10-04T17:00:00.000+0000",
      "territoryId" : "0HhB0000000TaHOKA0"
   } ]
}
Parse the JSON response, and show the available time slots for the selected resources. Here’s how a Select Service Appointment Time page can look.

A multi-resource appointment can have a maximum of five required service resources: one primary required service resource plus four required service resources, including asset resources.

Note

A representation of the selected required resources screen.

On the next page in your app, you can show the appointment details for the user to review and create the appointment.