Create Service Appointments
A service appointment represents an appointment booked through Salesforce Scheduler.
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-appointments Connect API to create
the service appointment.
- Resource URI
-
https://yourInstance.salesforce.com/services/data/vXX.X/connect/scheduling/service-appointments
- For an Existing User (Account)
-
- Sample Request
-
Pass the account ID as parentRecordId in the input request body.
Set status to Scheduled to indicate that the appointment is scheduled.
{ "serviceAppointment": { "serviceTerritoryId": "0Hhx000000012oSCAQ", "parentRecordId": "001x0000005DLxpAAG", "workTypeId": "08qx000000014fnAAA", "schedStartTime": "2022-04-19T10:30:00.000+0000", "schedEndTime": "2022-04-19T10:40:00.000+0000", "additionalInformation": "Appointment Scheduling Custom App.", "appointmentType": "Testing Purpose", "extendedFields": [ { "name": "status", "value": "Scheduled" } ] }, "assignedResources": [ { "serviceResourceId": "0Hnx000000006GcCAI", "isRequiredResource": "true" } ] }
-
- Sample Response
-
The API returns the service appointment ID and the assigned service resources.
{ "result": { "assignedResourceIds": [ "03rx00000001uxJAAQ" ], "serviceAppointmentId": "08px00000001toRAAQ" } }
- For a Guest User (Lead)
-
- Sample Request
-
Pass the required lead details in the input request body.
Set status to Scheduled to indicate that the appointment is scheduled.
{ "serviceAppointment": { "serviceTerritoryId": "0Hhx000000012oSCAQ", "workTypeId": "08qx000000014fnAAA", "schedStartTime": "2022-04-19T10:30:00.000+0000", "schedEndTime": "2022-04-19T10:40:00.000+0000", "additionalInformation": "Appointment Scheduling Custom App.", "appointmentType": "Testing Purpose", "extendedFields": [ { "name": "status", "value": "Scheduled" } ] }, "assignedResources": [ { "serviceResourceId": "0Hnx000000006H4CAI", "isRequiredResource": "true" } ], "lead": { "email": "name@company.com", "firstName": "FName", "lastName": "LName", "company": "CompanyName" } }
-
- Sample Response
-
The API returns the service appointment ID and the assigned service resources.
{ "result": { "assignedResourceIds": [ "03rx00000001uxOAAQ" ], "parentRecordId": "00Qx0000001cKPoEAM", "serviceAppointmentId": "08px00000001toWAAQ" } }
Create a page to show confirmation when the service appointment is created successfully.
Here’s how a sample confirmation page can look.