Create Service Appointments
Show your users the details of a service appointment—an appointment booked
through Salesforce Scheduler—so that users can review and create the
appointment.
- Create a page where the user can review the appointment details and create the appointment.
-
Make a POST request on the service-appointments Connect API to create the service
appointment.
- Resource URI
-
https://yourInstance.salesforce.com/services/data/v64.0/connect/scheduling/service-appointments
- For an Existing User (Account)
-
- Sample Request
-
Pass the account ID as parentRecordId in the input request body.
To indicate that the appointment is scheduled, set status to Scheduled.
{ "serviceAppointment": { "serviceTerritoryId": "0HhS700000001DYKAY", "parentRecordId": "001S7000001pFlJIAU", "engagementChannelTypeId": "0eFS70000004CG5MAM", "schedStartTime": "2023-02-15T17:00:00.000+0000", "schedEndTime": "2023-02-15T18:00:00.000+0000", "street": "121 Spear Street", "city": "Charlotte", "state": "VT", "postalCode": "05445", "country": "United States", "extendedFields": [ { "name": "status", "value": "Scheduled" } ] }, "assignedResources": [ { "serviceResourceId": "0HnS700000002jAKAQ", "isRequiredResource": true } ] }
-
- Sample Response
-
The API returns the service appointment ID and the assigned service resources.
{ "result": { "assignedResourceIds": [ "03rS700000000hPIAQ" ], "serviceAppointmentId": "08pS7000000018wIAA" } }
- For a Guest User (Lead)
-
- Sample Request
-
Pass the required lead details in the input request body.
To indicate that the appointment is scheduled, set status to Scheduled.
{ "serviceAppointment": { "serviceTerritoryId": "0HhS700000001DYKAY", "engagementChannelTypeId": "0eFS70000004CG5MAM", "schedStartTime": "2023-02-15T17:00:00.000+0000", "schedEndTime": "2023-02-15T18:00:00.000+0000", "street": "121 Spear Street", "city": "Charlotte", "state": "VT", "postalCode": "05445", "country": "United States", "extendedFields": [ { "name": "status", "value": "Scheduled" } ] }, "assignedResources": [ { "serviceResourceId": "0HnS700000002jAKAQ", "isRequiredResource": true } ], "lead": { "firstName": "Mark", "lastName": "Taylor", "phone": "012-345-6789", "email": "mtaylor@company.com", "company": "Company1" } }
-
- Sample Response
-
The API returns the service appointment ID and the assigned service resources.
{ "result": { "assignedResourceIds": [ "03rS700000000hUIAQ" ], "parentRecordId": "00QS7000000sfbOMAQ", "serviceAppointmentId": "08pS70000000191IAA" } }
Create a page to show confirmation when the service appointment is created successfully.
Here’s how a sample confirmation page can look.