0

Preface:

We have some processes / triggers / workflows setup to do some updates on child accounts and contacts once you update a certain field. For example, if you update the email field in the account, the "person in charge email" field on the child accounts and contacts also updates recursively down the whole hierarchy.

What happened:

I did an update on an account with 2000+ contacts in Salesforce Classic and got the "Apex CPU Limit time exceeded" error message.

Now on "accident"(because the org still uses Classic when I'm sometimes working in Lightning already) I've tried the same update again in Salesforce Lightning and the update went through without a problem.

The question:

Are there different limits in Lightning and Classic or how can we explain this behaviour?

Thanks

1 Answer 1

4

The limits are always the same. However, many governor limits are flexible. This means that if the server thinks it has the available resources, it can choose to ignore or extend the CPU timeout value to attempt to allow the transaction to finish. In theory, a transaction can get up to about 20,000ms or so before it is definitely terminated (and even higher on sandboxes). Odds are, the exact same update running more than once will "randomly" fail depending on server conditions. You'll want to do some profiling using the debug logs to find out where the most CPU time is going to, and try to optimize those parts.

1
  • Thanks, that makes a lot of sense. You are right about the debugging, we are working on making the performance better as we speak Jul 14, 2019 at 17:28

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .