I'm working in an after update Trigger in an object that update related records from another object. But I'm hitting CPU time limit when update about 400 related records (related list). In that cenario the CPU time consider as 1 transaction the whole process that is triggered in the second object, like flows, triggers etc? (The change in the first object is manually, so it will be just a change in one record, but updates about 400 in the second object).
Salesforce simply says that related object updation is taking more than 10 seconds.
For by passing this you can either have a
ByPass Trigger Mechanism (Tons of example on google), or fix/optimize the related object trigger to run inside 10 seconds. Read this for more info : https://help.salesforce.com/articleView?id=000339361&type=1&mode=1 .
As it says
All Apex code, this means including your related object triggers and workflows.
I think it worth adding reference the the Log Inspector since this can help the OP identify where most CPU is being used.– Phil WNov 19, 2020 at 7:32
Yes as suggested by @PhilW try to debug and optimize the related object trigger if you have got time. Nov 19, 2020 at 9:08
Thank you guys for all the help Nov 19, 2020 at 11:44