Apex CPU time limit exceeded

Distribution Engine(DE) needs to update records in order to assign them. DE can update relatively large volumes of records in a single update.  If an org makes use of Process Builder flows, triggers and workflows that fire on record update, it may occasionally see an error 'Apex CPU time limit exceeded'.  The error message may seem to indicate that the issue is with the Distribution Engine package but it is not necessarily the case. 

Salesforce has governor limits on server resources in order to be sure one org is not impacting the functionality of another.  Limiting the CPU time for Apex code is one of those limits.  From both a managed package and a customer/default perspective, the limit includes many commonly used sources such as process builder flows, triggers, and workflows.  As it is a shared resource, when the limit is hit the error message references the process that was the one to hit the limit, but that process is not necessarily the one that consumed the most resources.  In order to resolve the issue, the processes consuming the most resources need to be the focus.

One way to lower the impact of Distribution Engine updates is to exclude these from your automations where possible. Here are some articles that provide information on how to do this:

Salesforce has a few articles on improving efficiency in code:  Apex Code, Triggers and Bulk processing, Future methods, Best Practices for Designing Processes, and Bulkify code.

For issues needing a more immediate resolution, reducing the number of records attempting to assign can help.  


How did we do?

Classifier Errors