Change Service Resource

A service resource represents an employee from your organization, such as a loan officer, investment advisor, doctor, nurse practitioner, or retail store specialist, who attends appointments with clients.

  1. Create a page to show the available service resources.

  2. Make a POST request on the getAppointmentCandidates REST API by passing the required workTypeId and territoryIds parameters.

    Resource URI

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

    Sample Request

    To consider an existing user’s preferred visiting hours, pass accountId in the input request body. The preference is enforced when the Include Only Required Service Resources and Ignore Excluded Service Resources policy rules are enabled. For more information, see Add Service Resource Preferences to Accounts for Salesforce Scheduler.

    1{
    2  "startTime": "2023-03-24T09:00:00.000+0000",
    3  "endTime": "2023-03-24T19:00:00.000+0000",
    4  "accountId": "001S7000001pFlJIAU",
    5  "workType": {
    6    "id": "08qS70000004DQsIAM"
    7  },
    8  "territoryIds": [
    9    "0HhS700000001DYKAY"
    10  ],
    11  "schedulingPolicyId": "2F0VrRM0000004CUV",
    12  "engagementChannelTypeIds": [
    13    "0eFS70000004CGFMA2"
    14  ]
    15}

    Sample Response

    The API returns the available time slots and service resources.

    1{
    2  "candidates" : [ {
    3    "endTime" : "2023-03-24T17:00:00.000+0000",
    4    "engagementChannelTypeIds" : [ "0eFS70000004CGFMA2" ],
    5    "resources" : [ "0HnS700000002jAKAQ" ],
    6    "startTime" : "2023-03-24T16:00:00.000+0000",
    7    "territoryId" : "0HhS700000001DYKAY"
    8  }, {
    9    "endTime" : "2023-03-24T17:15:00.000+0000",
    10    "engagementChannelTypeIds" : [ "0eFS70000004CGFMA2" ],
    11    "resources" : [ "0HnS700000002jAKAQ" ],
    12    "startTime" : "2023-03-24T16:15:00.000+0000",
    13    "territoryId" : "0HhS700000001DYKAY"
    14  }, {
    15    "endTime" : "2023-03-24T17:30:00.000+0000",
    16    "engagementChannelTypeIds" : [ "0eFS70000004CGFMA2" ],
    17    "resources" : [ "0HnS700000002jAKAQ" ],
    18    "startTime" : "2023-03-24T16:30:00.000+0000",
    19    "territoryId" : "0HhS700000001DYKAY"
    20  }, {
    21    "endTime" : "2023-03-24T17:45:00.000+0000",
    22    "engagementChannelTypeIds" : [ "0eFS70000004CGFMA2" ],
    23    "resources" : [ "0HnS700000002jAKAQ" ],
    24    "startTime" : "2023-03-24T16:45:00.000+0000",
    25    "territoryId" : "0HhS700000001DYKAY"
    26  }, {
    27    "endTime" : "2023-03-24T18:00:00.000+0000",
    28    "engagementChannelTypeIds" : [ "0eFS70000004CGFMA2" ],
    29    "resources" : [ "0HnS700000002jAKAQ" ],
    30    "startTime" : "2023-03-24T17:00:00.000+0000",
    31    "territoryId" : "0HhS700000001DYKAY"
    32  }, {
    33    "endTime" : "2023-03-24T18:15:00.000+0000",
    34    "engagementChannelTypeIds" : [ "0eFS70000004CGFMA2" ],
    35    "resources" : [ "0HnS700000002jAKAQ" ],
    36    "startTime" : "2023-03-24T17:15:00.000+0000",
    37    "territoryId" : "0HhS700000001DYKAY"
    38  }, {
    39    "endTime" : "2023-03-24T18:30:00.000+0000",
    40    "engagementChannelTypeIds" : [ "0eFS70000004CGFMA2" ],
    41    "resources" : [ "0HnS700000002jAKAQ" ],
    42    "startTime" : "2023-03-24T17:30:00.000+0000",
    43    "territoryId" : "0HhS700000001DYKAY"
    44  }, {
    45    "endTime" : "2023-03-24T18:45:00.000+0000",
    46    "engagementChannelTypeIds" : [ "0eFS70000004CGFMA2" ],
    47    "resources" : [ "0HnS700000002jAKAQ" ],
    48    "startTime" : "2023-03-24T17:45:00.000+0000",
    49    "territoryId" : "0HhS700000001DYKAY"
    50  }, {
    51    "endTime" : "2023-03-24T19:00:00.000+0000",
    52    "engagementChannelTypeIds" : [ "0eFS70000004CGFMA2" ],
    53    "resources" : [ "0HnS700000002jAKAQ" ],
    54    "startTime" : "2023-03-24T18:00:00.000+0000",
    55    "territoryId" : "0HhS700000001DYKAY"
    56  } ]
    57}
  3. Parse the JSON response, and show the available resources on the page. Your users can select a service resource for the appointment from the page.

  4. Retrieve the available time slots for the selected engagement channel type and service resource. See Change Appointment Time.

Your users can select a resource and a time slot for the appointment from the page.