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

    https://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.

    {
      "totalSize": 3,
      "done": true,
      "records": [
        {
          "attributes": {
            "type": "ServiceAppointment",
            "url": "/services/data/v57.0/sobjects/ServiceAppointment/08pS70000000196IAA"
          },
          "AppointmentNumber": "SA-0003",
          "Status": "Scheduled",
          "SchedStartTime": "2023-03-15T16:00:00.000+0000",
          "SchedEndTime": "2023-03-15T17:00:00.000+0000",
          "ServiceTerritoryId": "0HhS700000001DYKAY",
          "WorkTypeId": null
        },
        {
          "attributes": {
            "type": "ServiceAppointment",
            "url": "/services/data/v57.0/sobjects/ServiceAppointment/08pS7000000018wIAA"
          },
          "AppointmentNumber": "SA-0001",
          "Status": "Scheduled",
          "SchedStartTime": "2023-02-15T17:00:00.000+0000",
          "SchedEndTime": "2023-02-15T18:00:00.000+0000",
          "ServiceTerritoryId": "0HhS700000001DYKAY",
          "WorkTypeId": null
        },
        {
          "attributes": {
            "type": "ServiceAppointment",
            "url": "/services/data/v57.0/sobjects/ServiceAppointment/08pS7000000019BIAQ"
          },
          "AppointmentNumber": "SA-0004",
          "Status": "Scheduled",
          "SchedStartTime": "2023-03-15T18:00:00.000+0000",
          "SchedEndTime": "2023-03-15T19:00:00.000+0000",
          "ServiceTerritoryId": "0HhS700000001DYKAY",
          "WorkTypeId": null
        }
      ]
    }
    
  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.