Create Service Appointments
The last step in the concurrent scheduling application is to show the service appointment details for the user to review and create the appointment. 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
1https://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.
1{
2 "serviceAppointment": {
3 "serviceTerritoryId": "0HhB00000001P0PKAU",
4 "parentRecordId" : "001B0000018vs9fIAA",
5 "workTypeId" : "08qB00000002ocgIAA",
6 "schedStartTime" : "2021-10-29T16:00:00.000+0000",
7 "schedEndTime": "2021-10-29T17:00:00.000+0000",
8 "additionalInformation" : "Concurrent Booking",
9 "appointmentType" : "Training Purpose",
10 "extendedFields" : [ {
11 "name": "status",
12 "value": "Scheduled"
13 } ]
14 },
15 "assignedResources": [
16 {
17 "serviceResourceId": "0HnB00000001SJxKAM",
18 "isRequiredResource" : "true"
19 }
20 ]
21}
Sample Response
The API returns the service appointment ID and the assigned service resources.
1{
2 "result" : {
3 "assignedResourceIds" : [ "03rB0000000cBZ6IAM" ],
4 "serviceAppointmentId" : "08pB0000000aKjMIAU"
5 }
6}
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.
1{
2 "serviceAppointment": {
3 "serviceTerritoryId": "0HhB00000001P0PKAU",
4 "schedStartTime" : "2021-10-29T16:00:00.000+0000",
5 "schedEndTime": "2021-10-29T17:00:00.000+0000",
6 "workTypeId" : "08qB00000002ocgIAA",
7 "additionalInformation" : "Concurrent Booking",
8 "appointmentType" : "Training Purpose",
9 "extendedFields" : [ {
10 "name": "status",
11 "value": "Scheduled"
12 } ]
13 },
14 "assignedResources": [
15 {
16 "serviceResourceId": "0HnB00000001SJxKAM",
17 "isRequiredResource" : "true"
18 }
19 ],
20 "lead": {
21 "email" : "name@company.com",
22 "firstName" : "FName",
23 "lastName" : "LName",
24 "company" : "CompanyName"
25 }
26}
Sample Response
The API returns the service appointment ID and the assigned service resources.
1{
2 "result" : {
3 "assignedResourceIds" : [ "03rB0000000cBAFIA2" ],
4 "parentRecordId" : "00QB000000ASSt5MAH",
5 "serviceAppointmentId" : "08pB0000000aKIgIAM"
6 }
7}
Create a page to show confirmation when the service appointment is created successfully.
Here’s how a sample confirmation page can look.
