Newer Version Available
Get Appointment Candidates
Returns a list of available service resources (appointment candidates) based on work
type group and service territories.
Syntax
- URI
- /services/data/vXX.X/scheduling/getAppointmentCandidates
- Available since release
- 45.0
- Formats
- JSON, XML
- HTTP methods
- POST
- Authentication
- Authorization: Bearer token
- Request body
-
Parameter Required Type Description accountId No String The ID of the associated account. allowConcurrent Scheduling No Boolean If true, allows scheduling of concurrent appointments in a time slot. If false, concurrent appointments aren’t allowed. The default is false. Available in API version 47.0 and later.
correlationId No String The ID to pass custom information to the ServiceResourceScheduleHandler Apex interface. For example, you can use the correlation ID to identify the app, website, or any other external system that calls this Apex interface implementation. If you don’t pass a custom value, a randomly generated identifier is passed. Available in API version 53.0 and later.
endTime No String The latest time that a time slot can end (inclusive). filterByResources No String[] A comma-separated list of service resource IDs. API returns only eligible service resources that are both in the list and in the selected service territory. The resources are sorted by the order in which the resource IDs are passed. Available in API version 51.0 and later. resourceLimitApptDistribution No Integer Specify the maximum number of service resources that you want to show during appointment scheduling when appointment distribution is enabled. Available in API version 53.0 and later. startTime No String The earliest time that a time slot can begin (inclusive). Defaults to the current time of the request, if empty. You can also use a time from the past. schedulingPolicyId No String The ID of the AppointmentSchedulingPolicy object. If no scheduling policy is passed in the request body, the default configurations are used. All Scheduling Policy Configurations are considered when using this API. territoryIds Yes String[] List of service territory IDs, where the work that is being requested is performed. workType Required if workTypeGroupId isn’t given. Work Type The type of the work to be performed. workTypeGroupId Required if workType isn’t given. String The ID of the work type group containing the work types that are being performed. - Response Body
- Execution of a successful request returns the response body containing a list of available appointment resources.
-
Parameter Required Type Description candidates Yes Candidates[] List of available appointment candidates.
Examples
- Request Body Example
- Using workTypeGroupId:
- Using workType:
- Using durationInMinutes and without workTypeGroupId or workType
id
fields:
- Response Body Example
-
Prerequisites
The appointment time slots are determined based on your Salesforce Scheduler data model configurations. Here are some prerequisites that you can consider while setting up data.
- Set up Salesforce Scheduler before making requests. This setup includes creating or configuring Service Resources, Service Territory Members, Work Type Groups, Work Types, Work Type Group Members, and Service Territory Work Types. See Set Up Salesforce Scheduler for more information.
- The territory type of the Service Territory Member must be either Primary, Secondary, or Relocation. The Primary and Relocation territory types are considered the same.
- The territory type of the Service Territory Member must be either Primary, Secondary, or Relocation. The Primary and Relocation territory types are considered the same.
Rules and Guidelines
The following factors are considered for returning start time and end time of resources.
- Resource Availability
- Determined using service territory member, service territory, work type, and account operating hours fields.
- Resource Unavailability
- Determined by resource absences, existing appointments that the resource is assigned to. The resource must be marked as a required resource for the appointment with a status that isn’t in closed, canceled, or completed.
- Appointment Start Time Interval in the Scheduling Policy
- Appointment start time interval field in the Scheduling Policy is used to determine when the appointment can start. This interval can be 5, 10, 15, 20, 30, or 60. By default, it’s set to 15.
- Work Type Duration
- The end time is calculated as start time + duration of the work type.