Best Practices for Timesheet Engine Reprocessing
The Timesheet Engine runs as a scheduled job that creates and reprocesses time entry records. When the engine reprocesses time entries after updates to source records, such as work details, tasks, and events, it maintains accurate timesheet data but increases processing load on the org.
In high-volume scenarios, this additional load can exceed Salesforce Apex CPU time limits and cause the scheduled job to fail.
This behavior occurs when the SET002 (Module: Timesheets; Submodule: Timesheet Engine) setting is enabled for the org. For more information, see Time Entries and Daily Summary Update from Source Record Updates.
The following sections describe root cause, resolution and best practices, and recommended guidelines
Root Cause
The issue occurs when too many records are reprocessed in a single Apex batch. The volume processed per batch follows this formula:
Total Records per Apex Batch = Batch Size (SET001) x Average Number of Time Entries per User (from Open Timesheets).
When the total exceeds approximately 1000 records per batch, the Salesforce Apex CPU limits increases significantly.
The following examples illustrate the risk at different configurations:
Batch Size (SET001)
Average Time Entries per User
Total Records per Batch
Risk Level
5
50
250
Safe
10
100
1000
Threshold
10
120
1200
High risk
Resolution and Best Practices
To prevent Apex CPU limit errors, adjust the following configurations.
Reduce Batch Size for SET001: Lower the batch size so the engine processes fewer records in each Apex batch. The default value is 50.
Limit Historical Time Entries Processing: In the Autofill tab of the Timesheet Configuration Template, reduce the number of prior-period time entries that are considered during reprocessing.
Recommended Guideline
To maintain optimal performance, ensure that (SET001) x Average Time Entries per User is less than 500. This threshold helps keep processing within safe Apex CPU limits and reduces the risk of scheduled job failures.
Was this helpful?