I need your advice to implement a procedure to monitor salesforce governor limit status such as CPU limit, Heap size and warn the administrator before it is reached the maximum threshold and throw as salesforce error
- Problem context:
we got a strange situation, the data loader updates less than 1000 records and we maintain the batch size 1 to minimize the resource cost. This process will update data in 2 objects .user update bill information from data loader. This update happens in the bill object's update trigger. then it gets bill line item (Detail object of the bill ). each line item has a related service item (separate customer object ). there are 2 update routines to update Service items - update cheque detail of the related bill - updates service item status. there is an if-else condition These 3 objects have lot of validation rules, process builder and flows
An issue was reported by the client some of the SI statuses were not updated but cheque detail updated correctly. when we re-run the update for a subset of bills which were failed, then it worked perfectly. hence, we come to a conclusion there is no data issue.
when we escalated this situation to salesforce and got feedback. it says there is no error on the server but CPU cost gets close to the limit during the process.