Change Appointment Time

A time slot represents a period in a day when an appointment can be scheduled.

  1. Create a page to show the available time slots for the resource associated with the appointment.

  2. Make a POST request on the getAppointmentSlots REST API by passing the required workTypeGroupId or workTypeId parameter along with the .territoryId parameter.

    Resource URI

    1https://yourInstance.salesforce.com/services/data/v68.0/scheduling/getAppointmentSlots

    Sample Request

    Using the WorkTypeId parameter.

    1{
    2  "workType": {
    3    "id": "08qS70000004DQsIAM"
    4  },
    5  "territoryIds": [
    6    "0HhS700000001DYKAY"
    7  ],
    8  "requiredResourceIds": [
    9    "0HnS700000002jAKAQ"
    10  ],
    11  "accountId": "001S7000001pFlJIAU",
    12  "schedulingPolicyId": "2F0VrRM0000004CUV",
    13  "engagementChannelTypeIds": [
    14    "0eFS70000004CGFMA2"
    15  ]
    16}

    Using the WorkTypeGroupId parameter.

    1{
    2  "workTypeGroupId": "0VS2x0000008ZotGAE",
    3  "accountId": "001S7000001pFlJIAU",
    4  "schedulingPolicyId": "2F0VrRM0000004CUV",
    5  "territoryIds": [
    6    "0HhS700000001DYKAY"
    7  ],
    8  "requiredResourceIds": [
    9    "0HnS700000002jAKAQ"
    10  ],
    11  "engagementChannelTypeIds": [
    12    "0eFS70000004CGFMA2"
    13  ]
    14}

    Sample Response

    The API returns the available time slots for a resource.

    1{
    2  "timeSlots" : [ {
    3    "endTime" : "2023-03-26T17:55:00.000+0000",
    4    "remainingAppointments" : 1,
    5    "startTime" : "2023-03-26T17:30:00.000+0000",
    6    "territoryId" : "0HhS700000001DYKAY"
    7  }, {
    8    "endTime" : "2023-03-30T16:55:00.000+0000",
    9    "remainingAppointments" : 1,
    10    "startTime" : "2023-03-30T16:30:00.000+0000",
    11    "territoryId" : "0HhS700000001DYKAY"
    12  }, {
    13    "endTime" : "2023-04-02T16:55:00.000+0000",
    14    "remainingAppointments" : 1,
    15    "startTime" : "2023-04-02T16:30:00.000+0000",
    16    "territoryId" : "0HhS700000001DYKAY"
    17  }, {
    18    "endTime" : "2023-04-04T18:25:00.000+0000",
    19    "remainingAppointments" : 1,
    20    "startTime" : "2023-04-04T18:00:00.000+0000",
    21    "territoryId" : "0HhS700000001DYKAY"
    22  } ]
    23}
  3. 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.