Get Service Appointments

A service appointment represents an appointment booked through Salesforce Scheduler.

  1. Create a page to show the service appointments.

  2. Use the Query() request on the ServiceAppointment object to retrieve the list of service appointments associated with an account.

    Sample Request

    1https://yourInstance.salesforce.com/services/data/v68.0/query/?q=​SELECT+AppointmentNumber,+Status,+SchedStartTime,+SchedEndTime,+ServiceTerritoryId,+WorkTypeId+From+ServiceAppointment+WHERE+AccountId+=+'001S7000001pFlJIAU'

    Sample Response

    The method returns the available service appointments.

    1{
    2  "totalSize": 3,
    3  "done": true,
    4  "records": [
    5    {
    6      "attributes": {
    7        "type": "ServiceAppointment",
    8        "url": "/services/data/v57.0/sobjects/ServiceAppointment/08pS70000000196IAA"
    9      },
    10      "AppointmentNumber": "SA-0003",
    11      "Status": "Scheduled",
    12      "SchedStartTime": "2023-03-15T16:00:00.000+0000",
    13      "SchedEndTime": "2023-03-15T17:00:00.000+0000",
    14      "ServiceTerritoryId": "0HhS700000001DYKAY",
    15      "WorkTypeId": null
    16    },
    17    {
    18      "attributes": {
    19        "type": "ServiceAppointment",
    20        "url": "/services/data/v57.0/sobjects/ServiceAppointment/08pS7000000018wIAA"
    21      },
    22      "AppointmentNumber": "SA-0001",
    23      "Status": "Scheduled",
    24      "SchedStartTime": "2023-02-15T17:00:00.000+0000",
    25      "SchedEndTime": "2023-02-15T18:00:00.000+0000",
    26      "ServiceTerritoryId": "0HhS700000001DYKAY",
    27      "WorkTypeId": null
    28    },
    29    {
    30      "attributes": {
    31        "type": "ServiceAppointment",
    32        "url": "/services/data/v57.0/sobjects/ServiceAppointment/08pS7000000019BIAQ"
    33      },
    34      "AppointmentNumber": "SA-0004",
    35      "Status": "Scheduled",
    36      "SchedStartTime": "2023-03-15T18:00:00.000+0000",
    37      "SchedEndTime": "2023-03-15T19:00:00.000+0000",
    38      "ServiceTerritoryId": "0HhS700000001DYKAY",
    39      "WorkTypeId": null
    40    }
    41  ]
    42}
  3. Parse the JSON response, and show the service appointments on a page that you created.

Your users can select a service appointment to modify from the page.