In Salesforce Field Service (SFS), the Book Appointment action and the GetSlots Application Programming Interface (API) can trigger an "APEX CPU Time Limit Exceeded" error.
This error occurs when the system performs a synchronous (sync) Apex operation — which is limited to 10 seconds — and the computation exceeds that threshold. The error is most commonly encountered when:
To resolve the "APEX CPU Time Limit Exceeded" error in Salesforce Field Service when booking an appointment or using the GetSlots API, apply one or more of the following performance improvements:
Navigate to: Field Service Settings > Scheduling > Maximum days to get candidates or to book an appointment.
Increasing this value decreases performance and can trigger the APEX CPU Time Limit Exceeded error. Set this value as low as your business requirements allow.
Use the "Use Async Logic" field on the Service Appointment (SA) record to switch from a synchronous operation (Apex CPU limit: 10 seconds) to an asynchronous operation (limit: 60 seconds). This significantly reduces the risk of hitting the CPU limit.
Navigate to: Field Service Settings > Scheduling > Limit Apex Operations.
Enabling this feature prevents the system from exceeding the CPU limit by stopping before all optional slots are evaluated. Note: this may result in fewer candidate slots being returned.
Turn down your debug log level to an absolute minimum. Do not use active tracing unless it is absolutely necessary for active troubleshooting, as debug logging significantly increases CPU usage.
000395654

We use three kinds of cookies on our websites: required, functional, and advertising. You can choose whether functional and advertising cookies apply. Click on the different cookie categories to find out more about each category and to change the default settings.
Privacy Statement
Required cookies are necessary for basic website functionality. Some examples include: session cookies needed to transmit the website, authentication cookies, and security cookies.
Functional cookies enhance functions, performance, and services on the website. Some examples include: cookies used to analyze site traffic, cookies used for market research, and cookies used to display advertising that is not directed to a particular individual.
Advertising cookies track activity across websites in order to understand a viewer’s interests, and direct them specific marketing. Some examples include: cookies used for remarketing, or interest-based advertising.