A service appointment represents an appointment booked through Salesforce Scheduler. Make a POST request on the service-appointments Connect API to create the appointment.
-
Create a page where the user can review the appointment details and create the appointment.
Here’s how a Review Service Appointment page can look.

-
Link the Next button to a POST request on the
service-appointmentsConnect API to create the service appointment.Resource URI
https://yourInstance.salesforce.com/services/data/vXX.X/connect/scheduling/service-appointmentsFor an Existing User (Account)
Sample Request
Pass the account ID as
parentRecordIdin the input request body.Set
statustoScheduledto indicate that the appointment is scheduled.{ "serviceAppointment": { "serviceTerritoryId": "0HhS700000001DYKAY", "parentRecordId" : "001S7000001pFlJIAU", "schedStartTime" : "2023-11-30T17:00:00.000+0000", "schedEndTime": "2023-11-30T18:00:00.000+0000", "street": "121 Spear Street", "city": "Charlotte", "state": "VT", "postalCode": "05445", "country": "United States", "engagementChannelTypeId" : "0eFS70000004CG5MAM", "extendedFields" : [{ "name": "status", "value": "Scheduled" }] }, "assignedResources": [ { "serviceResourceId": "0HnS700000002jAKAQ", "isRequiredResource": true, "isPrimaryResource": true, "extendedFields" : [] }, { "serviceResourceId": "0HnS700000002jKKAQ", "isRequiredResource": true, "isPrimaryResource": false, "extendedFields" : [] } ] }Sample Response
The API returns the service appointment ID and the assigned service resources.
{ "result": { "assignedResourceIds": [ "03rS700000000ogIAA", "03rS700000000ohIAA" ], "serviceAppointmentId": "08pS700000001GIIAY" } }For a Guest User (Lead)
Sample Request
Pass the required lead details in the input request body.
Set
statustoScheduledto indicate that the appointment is scheduled.{ "serviceAppointment": { "serviceTerritoryId": "0HhS700000001DYKAY", "schedStartTime" : "2023-11-30T17:00:00.000+0000", "schedEndTime": "2023-11-30T18:00:00.000+0000", "street": "121 Spear Street", "city": "Charlotte", "state": "VT", "postalCode": "05445", "country": "United States", "engagementChannelTypeId" : "0eFS70000004CG5MAM", "extendedFields" : [{ "name": "status", "value": "Scheduled" }] }, "assignedResources": [ { "serviceResourceId": "0HnS700000002jAKAQ", "isRequiredResource": true, "isPrimaryResource": true, "extendedFields" : [] }, { "serviceResourceId": "0HnS700000002jKKAQ", "isRequiredResource": true, "isPrimaryResource": false, "extendedFields" : [] } ] , "lead": { "firstName": "Philip", "lastName": "Taylor", "phone": "012-345-6789", "email": "pmtaylor@company.com", "company": "Philip&Taylor Company", "extendedFields" : [] } }Sample Response
The API returns the service appointment ID and the assigned service resources.
{ "result": { "assignedResourceIds": [ "03rS700000000oqIAA", "03rS700000000orIAA" ], "parentRecordId": "00QS7000000sfcxMAA", "serviceAppointmentId": "08pS700000001GSIAY" } }
Create a page to show confirmation when the service appointment is created successfully.
Here’s how a sample confirmation page can look.
