CPU Limit Errors
Full Circle applications have after update triggers on many of the core Salesforce objects including Lead, Contact, Account, Opportunity, and CampaignMember. If you have processes that also perform updates to these objects, you may experience Salesforce CPU limit errors.
Typically, this happens due to an infinite update loop (recursion) where our application makes an update to the object, triggering your process to make its update which in turn triggers our application again, which in turn triggers your process again, and this loop continues until the execution context exceeds the Salesforce CPU limit and and an error is thrown.
Below are recommended solutions to this issue.
Solution: Use before-save update flows instead of processes
Before-save update flows were introduced in the Spring 20 release and are the most efficient declarative method available for updating records. Using a before-save update flow avoids recursion and is up to 10 times faster than a process record update. Replace your processes that perform record updates with before-save update flows.
When to use
- You only need to make updates to the record that triggers the flow
- You don't need access to fields that are only available after the record has been saved
References
- Spring 20 Release Notes
- https://www.youtube.com/watch?v=bX4kLUdM3Gg
- ISCHANGED and PRIORVALUE in Before Save Flows
If you are unable to use before-save update flows, refer to the solution entitled "Don't run processes when Full Circle is updating a record" to avoid recursion and CPU limit errors.
Solution: Don't run processes* when Full Circle is updating a record
* Processes include process builders, flows, workflows, and other third-party applications
The most common way to avoid this error is to prevent the recursion in the first place. To do this, you will need to modify your process to ensure that it does not attempt to execute any actions while Full Circle is updating a record.
When a process updates a record, it usually updates fields that are packaged with their own application. In most cases, your processes shouldn't need to make updates based on changes to these fields. In other words, if a process is doing work that is unrelated to Full Circle, doesn't need to trigger Full Circle, and wasn't designed to interface with Full Circle at all, you can safely bypass it.
You can do this by referencing our Admin Update Counter field in your non-FCI processes. When Full Circle updates a record, it increments the value of this field. When you have identified a process that is causing a recursion error with Full Circle, add the following line to prevent it from running when FCI is trying to update a record:
NOT(ISCHANGED(FCMM__LAM_Admin_Update_Counter__c))
Admin Update Counter exists on the following objects in Matchmaker: Lead, Account
When to use
- You are running Full Circle Matchmaker in your org
- You have a process that's updating any of the objects mentioned above and you are experiencing CPU limit errors
References
Apex Triggers
If you have an after update trigger on any of the objects mentioned above, you'll want to avoid recursion into Full Circle triggers, as described above. To do so you can use the Admin Update Counter field to prevent your triggers from running when Full Circle is making updates to records. Simply add some logic to your trigger to check the old value against the new value for Admin Update Counter field, and if it has changed then your trigger should exit.
Comments
0 comments
Please sign in to leave a comment.