Service Appointments
Create and update service appointment records, assign resources, and
generate leads, including group appointments with multiple participants.
- Resource
-
/connect/scheduling/service-appointments
- Example
-
https://yourInstance.salesforce.com/services/data/v63.0/connect/scheduling/service-appointments
- Available version
- 48.0
- HTTP methods
- POST, PATCH
PATCH is available in version 51.0 and later.
- Request body for POST
-
- JSON example
-
{ "serviceAppointment": { "parentRecordId": "0012w000004oZXgAAM", "workTypeId": "08q2w000000XmniAAC", "serviceTerritoryId": "0Hh2w000000XmoXCAS", "engagementChannelTypeId": "0eFRM00000000Bv2AI", "schedStartTime": "2020-02-26T15:00:00.000Z", "schedEndTime": "2020-02-26T16:00:00.000Z", "street": "1 Market Street", "city": "San Francisco", "state": "CA", "postalCode": "94105", "country": "USA", "appointmentType": "In Person", "appointmentMode": "Group", "attendeeLimit": "20", "extendedFields": [ { "name": "Email", "value": "rachel.adams@salesforce.com" }, { "name": "Phone", "value": "111111111" }, { "name": "Description", "value": "Test Description" } ] }, "assignedResources": [ { "serviceResourceId": "0Hn2w000000gDWDCA2", "isRequiredResource": true, "isPrimaryResource": true, "extendedFields": [] }, { "serviceResourceId": "0Hn2w000000gCqnCAE", "isRequiredResource": true, "isPrimaryResource": false, "extendedFields": [] } ] }
- JSON example for unauthenticated user
-
{ "serviceAppointment": { "workTypeId": "08q2w000000XmniAAC", "serviceTerritoryId": "0Hh2w000000XmoXCAS", "engagementChannelTypeId": "0eFRM00000000Bv2AI", "schedStartTime": "2020-02-26T15:00:00.000Z", "schedEndTime": "2020-02-26T16:00:00.000Z", "street": "1 Market Street", "city": "San Francisco", "state": "CA", "postalCode": "94105", "country": "USA", "appointmentType": "In Person", "appointmentMode": "Group", "attendeeLimit": "20", "extendedFields": [] }, "assignedResources": [ { "serviceResourceId": "0Hn2w000000gDWDCA2", "isRequiredResource": true, "isPrimaryResource": true, "extendedFields": [] } ], "lead": { "firstName": "Rachel", "lastName": "Adams", "phone": "012-345-6789", "email": "rachel.adams@salesforce.com", "company": "Salesforce", "extendedFields": [] } }
- Properties
-
Name Type Description Required or Optional Available Version assignedResources Assigned Resource Input[] Service resource who is assigned to a service appointment. Optional 48.0 lead Lead Input[] Prospect or lead. Required if serviceAppointment isn’t provided 48.0 schedulingPolicyId String ID of the AppointmentSchedulingPolicy object. If no scheduling policy is passed in the request body, the default configurations are used. The only scheduling policy configuration that is used in determining time slots is the enforcement of account visiting hours. Optional 48.0 serviceAppointment Service Appointment Input[] Appointment to complete a service work for a customer. Required if lead isn’t provided 48.0
- Request body for PATCH
-
- JSON example
-
{ "serviceAppointmentId": "08pxx0000004C92AAE", "serviceAppointment": { "workTypeId": "08pxx0000004C92AAE", "serviceTerritoryId": "0Hh2xx0000004CAeCAM", "engagementChannelTypeId": "0eFRM0000004CC22AM", "schedStartTime": "2020-09-15T16:00:00+0000", "schedEndTime": "2020-09-15T17:00:00+0000", "street": "1 Market Street", "city": "San Francisco", "state": "CA", "postalCode": "94105", "country": "USA", "appointmentType": "In Person", "appointmentMode": "Group", "attendeeLimit": "20", "extendedFields": [ { "name": "Email", "value": "rachel.adams@salesforce.com" }, { "name": "Phone", "value": "111111111" }, { "name": "Description", "value": "Test Description" } ], "assignedResources": [ { "serviceResourceId": "0Hnxx0000004CAeCAM", "isRequiredResource": true, "isPrimaryResource": false, "extendedFields": [] }, ] }
- Request example to update the scheduled time
-
{ "serviceAppointmentId": "08pxx0000004C92AAE", "serviceAppointment": { "schedStartTime": "2020-09-15T16:00:00+0000", "schedEndTime": "2020-09-15T17:00:00+0000", }
- Request example to update the work type
-
{ "serviceAppointmentId": "08pxx0000004C92AAE", "serviceAppointment": { "workTypeId": "08qxx0000004C92AAE", }
- Request example to update the service territory
-
{ "serviceAppointmentId": "08pxx0000004C92AAE", "serviceAppointment": { "serviceTerritoryId": "0Hhxx0000004CAeCAM" }
- Properties
-
Name Type Description Required or Optional Available Version assignedResources Assigned Resource Input[] Service resource who is assigned to a service appointment. When updating an appointment, pass the complete list of resources needed.
If you don’t pass a resource that is assigned to a service appointment, the API deletes that assigned resource. For example, suppose that an existing service appointment has assigned resources: A and B and if you pass assigned resources: B and C. The API checks the resource availability of B and C for existing work type and service territory, and if both are available, the service appointment gets updated with:- Resource A—Deleted
- Resource B—Updated
- Resource C—Created
However, if you don’t pass any of the assigned resources, the API assumes there is no change.
Optional 51.0 schedulingPolicyId String ID of the AppointmentSchedulingPolicy object. If no scheduling policy is passed in the request body, the default configurations are used. The only scheduling policy configuration that is used in determining time slots is the enforcement of account visiting hours. Optional 51.0 serviceAppointment Service Appointment Input[] Appointment to complete a service work for a customer. When updating an appointment, pass only the fields that need to be updated.
Required 51.0 serviceAppointmentId String ID of the service appointment that you want to update. Required 51.0
- Response body for POST and PATCH
- Service Appointment Output
- Considerations for using engagment channel types with the service-appointments resource
-
- Schedule Appointments Using Engagement Channels must be enabled in Salesforce Scheduler Settings in your Salesforce org.
- When you create or modify appointments, shifts must be defined in the scheduling policy. For more information on setting up shifts in the scheduling policy, see Define Shift Rules in Scheduling Policy.
- When you use engagement channels and shifts to create or modify a service appointment, Salesforce Scheduler must consider the default value for the Appointment Type (if not specified). However, Salesforce Scheduler only considers the engagement channel and Appointment Type is ignored.