7

We are having a Case Trigger framework where we do a lot of functionalities related to the Case object. But when we do the Mass Case operation we hit the CPU time limit exception. We have debugged the code and figure it out that the Process Builder consumes more time to process. We have seen around 30 odd Process Builder for the same Case object. As far as I know as a best practice we have to have one Process builder per Object.

Can anybody tell how we can overcome this CPU time-limit issue? Because when we deactivate all the 30 odd PB's we can able to resolve the issue, and also it's very hard to find the exact PB causing the issue because we have to test like 30 odd! testing and also we can't guarantee the order of PB execution.

I appreciate the experts' suggestions!!

1
  • if you have PBs that update the same object that triggered them (action group does a field update on Case), it is worth moving that logic to inside your Case trigger handler as you avoid round trips
    – cropredy
    Commented May 12, 2020 at 17:39

1 Answer 1

10

Combining your 30+ processes into a single process would improve performance, but you'd get even better performance if you went with a flow or trigger. As a flow, you'd want two flows. One for updating the current case (a "before save" flow) and one for updating related records (an "after save" flow). Modern flows are pretty efficient in most cases and should serve you well. However, if you absolutely need the extra efficiency, Apex Code is still the way to go. A flow or process is simply not as efficient as straight code, although the performance gap has been closing significantly over the past couple of years.

You must log in to answer this question.

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