The service cloud in our org is heavily configured especially with several e-mail to cases. In addition to that, we also have workflows and processes(five) built using process builder on the case object that use lightning flows. So the issue is, when trying update cases more than 200 using dml statement, the system would throw the apex cpu time limit error. Upon investigating, we found the process builder processes that use lighting flows are consuming the maximum time. So my question is, would it be advisable to transfer the functionality the flows deliver to triggers? Would that reduce time consumption considering the fact that triggers process 200 records in batch? Is that a good strategy to follow? What's interesting is, the number of processes are not that many but they are consuming the maximum time which is something I do not understand.

1 Answer 1



enter image description here

Best practice says "one record-change process per object". Considering you mentioned workflows and triggers on Cases, it's safe to say you can do a lot to help your situation.

This doesn't mean you need to rush to convert everything to code. The bigger question is what actions are you taking in your PBs considering there's 5 of them and whether they'd be better off as code (better error handling, containing all business logic in code, etc).

At the very least, I'd test moving the logic in the 5 separate PBs into one PB as I'd guess it would save you considerable time in execution based on personal tests/experience.

  • Kris - Thank you for your answer. I will try to implement this and test it.
    – sunny
    Dec 11, 2019 at 22:03
  • N.B. each Action Group that is executed upon the same record will cause DML to recur; hence consolidating logic as you suggest is step 1
    – cropredy
    Dec 11, 2019 at 23:18

You must log in to answer this question.

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