Get Service Resources

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 workTypeGroupId and territoryIds parameters.

    Resource URI

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

    Where YOUR_INSTANCE is a variable.

    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-02-15T09:00:00.000+0000",
    3  "endTime": "2023-02-15T19:00:00.000+0000",
    4  "accountId": "001S7000001pFlJIAU",
    5  "workTypeGroupId": "0VSS700000000sVOAQ",
    6  "territoryIds": [
    7    "0HhS700000001DYKAY"
    8  ],
    9  "engagementChannelTypeIds": [
    10    "0eFS70000004CG5MAM"
    11  ]
    12}

    Sample Response

    The API returns the service resources available for the specified time slots.

    1{
    2  "candidates" : [ {
    3    "endTime" : "2023-02-15T18:00:00.000+0000",
    4    "engagementChannelTypeIds" : [ "0eFS70000004CG5MAM" ],
    5    "resources" : [ "0HnS700000002jAKAQ" ],
    6    "startTime" : "2023-02-15T17:00:00.000+0000",
    7    "territoryId" : "0HhS700000001DYKAY"
    8  }, {
    9    "endTime" : "2023-02-15T18:15:00.000+0000",
    10    "engagementChannelTypeIds" : [ "0eFS70000004CG5MAM" ],
    11    "resources" : [ "0HnS700000002jAKAQ" ],
    12    "startTime" : "2023-02-15T17:15:00.000+0000",
    13    "territoryId" : "0HhS700000001DYKAY"
    14  }, {
    15    "endTime" : "2023-02-15T18:30:00.000+0000",
    16    "engagementChannelTypeIds" : [ "0eFS70000004CG5MAM" ],
    17    "resources" : [ "0HnS700000002jAKAQ" ],
    18    "startTime" : "2023-02-15T17:30:00.000+0000",
    19    "territoryId" : "0HhS700000001DYKAY"
    20  }, {
    21    "endTime" : "2023-02-15T18:45:00.000+0000",
    22    "engagementChannelTypeIds" : [ "0eFS70000004CG5MAM" ],
    23    "resources" : [ "0HnS700000002jAKAQ" ],
    24    "startTime" : "2023-02-15T17:45:00.000+0000",
    25    "territoryId" : "0HhS700000001DYKAY"
    26  }, {
    27    "endTime" : "2023-02-15T19:00:00.000+0000",
    28    "engagementChannelTypeIds" : [ "0eFS70000004CG5MAM" ],
    29    "resources" : [ "0HnS700000002jAKAQ" ],
    30    "startTime" : "2023-02-15T18:00:00.000+0000",
    31    "territoryId" : "0HhS700000001DYKAY"
    32  } ]
    33}
  3. Parse the JSON response, and show the actual service resources on a page.

Your users can select a service resource for the appointment from the page.