AppointmentSchedulingPolicy defines rules for scheduling appointments in Lightning Scheduler. It combines service-resource eligibility criteria, availability checks, and the interval between proposed appointment start times. A resource can meet the policy's membership or skill criteria and still be unavailable because of calendar events, shifts, operating hours, or visiting hours.
The policy defines selection criteria, not individual resources' skills, territory memberships, or required/excluded status. It can reference a separate AppointmentAssignmentPolicy and a custom Apex class for external-calendar checks; neither is embedded in the scheduling policy.
Key Elements
All Boolean elements listed below are required and accept true or false.
| Element | What the Element Controls |
|---|---|
appointmentStartTimeInterval |
Required. Minutes between proposed appointment start times, not appointment duration. Allowed values are 5, 10, 15, 20, 30, 45, 60, 90, 120, 150, 180, 240, 300, 360, 420, and 480. |
appointmentAssignmentPolicy |
The name of a separate appointment assignment policy. |
extCalEventHandler |
Required. The API name of the custom Apex class that checks external calendar events and returns time slots when service resources are already booked. |
shouldCheckExternalCalendar |
Whether to check external calendars for resource availability. |
shouldConsiderCalendarEvents |
Whether Salesforce calendar events contribute to resource availability checks. |
isSvcTerritoryMemberShiftUsed |
Whether to consider service territory members' shifts when determining availability. |
isSvcTerrOpHoursWithShiftsUsed |
Whether to use the intersection of shifts and service territory operating hours: the times that fall within both. |
shouldEnforceExcludedResource |
Whether to prevent excluded service resources from being assigned. |
shouldEnforceRequiredResource |
Whether to allow assignment only to required service resources. |
shouldMatchSkill |
Whether to restrict assignment to required service resources with the relevant skills. |
shouldMatchSkillLevel |
Whether to apply skill-level criteria as well as skill criteria to required service resources. |
shouldUsePrimaryMembers, shouldUseSecondaryMembers
|
Whether eligibility is restricted to primary service territory members and whether secondary members are eligible, respectively. Interpret both settings together. |
shouldRespectVisitingHours |
Whether to prevent scheduling outside an account's visiting hours. |
Behavior and Constraints
Access to this metadata type requires both the ViewSetup and CustomizeApplication user permissions.
Eligibility settings apply different restrictions
Excluding resources and requiring resources are separate controls. shouldEnforceExcludedResource prevents assignment to excluded resources; shouldEnforceRequiredResource limits assignment to required resources. Neither setting defines which individual resources have that status.
Skill matching and skill-level matching are also configured separately. Check both shouldMatchSkill and shouldMatchSkillLevel when diagnosing why a resource meets or fails the policy's skill criteria. Likewise, review both territory-membership settings rather than interpreting primary or secondary membership eligibility from just one flag.
Salesforce and external calendars use separate controls
Enabling shouldConsiderCalendarEvents does not express an external-calendar check. External-calendar behavior involves shouldCheckExternalCalendar and the Apex implementation named by extCalEventHandler.
The handler returns booked time slots, not available appointment slots. Its output describes when service resources are already occupied, so the policy configuration alone does not describe the complete external-calendar behavior.
Shifts, operating hours, and visiting hours are distinct
isSvcTerritoryMemberShiftUsed considers member shifts. isSvcTerrOpHoursWithShiftsUsed considers the overlap between shifts and service territory operating hours, adding territory operating hours as a time boundary. These are not two names for the same setting. Account visiting hours are controlled separately by shouldRespectVisitingHours.
The start-time interval does not set appointment duration
With appointmentStartTimeInterval set to 15, proposed starts can occur at 10:00, 10:15, 10:30, and so on. Those starts remain subject to resource eligibility and availability checks. Although the element is exposed as a string, its documented values are limited to the minute intervals listed above.
Deployment and Retrieval
Components use the .policy suffix and are stored in the appointmentSchedulingPolicies folder. In package.xml, use the type name AppointmentSchedulingPolicy. The manifest supports * to select all components of this type.
The inherited fullName identifies the metadata component. The required masterLabel supplies its label; it is not the component identity.
For dependency analysis, follow the values actually populated in appointmentAssignmentPolicy and extCalEventHandler. These are references to separate components, not definitions included inside the policy. Neither relationship alone establishes a mandatory deployment sequence.
Relationships
The policy connects to an assignment-policy component by name and an external-calendar handler by Apex class API name. Review those specific referenced components when assessing the impact of a policy change.
References
-
AppointmentAssignmentPolicy:appointmentAssignmentPolicy. -
ApexClass:extCalEventHandler.
Documentation Inconsistencies
The official declarative sample omits extCalEventHandler, isSvcTerritoryMemberShiftUsed, and isSvcTerrOpHoursWithShiftsUsed, even though their field definitions mark them as required. Do not treat that sample as a complete list of required elements.
Common Questions
Where are AppointmentSchedulingPolicy files stored, and can I retrieve them with a wildcard?
They are stored in appointmentSchedulingPolicies with the .policy suffix. Use AppointmentSchedulingPolicy as the manifest type name; * is supported.
Does appointmentStartTimeInterval control appointment duration?
No. It controls the spacing between proposed start times. A value of 15 permits starts at 15-minute intervals, subject to the policy's eligibility and availability criteria.
Why can a resource match the policy but still have no available appointment times?
Eligibility and availability are different checks. A resource can meet skill or territory-membership criteria while calendar events, shifts, operating hours, or visiting hours prevent scheduling at a proposed time.
Does checking Salesforce calendar events also check external calendars?
No. shouldConsiderCalendarEvents controls Salesforce calendar events. External-calendar checks use shouldCheckExternalCalendar and the custom Apex class named in extCalEventHandler, which returns booked time slots.
Which permissions are required to access AppointmentSchedulingPolicy metadata?
Both ViewSetup and CustomizeApplication are required.