You need to sign in to do that
Don't have an account?
Maximum CPU time Exception Aggregation?
I have a trigger on the QuotelineItem that has some complex discount logic, it has been through mutiple iterations of optimization. It will run well within gov limits when dealing with a batch of 200 records. The problem is when we need to do Apex DML to all quotelineItems on a large quote (500+ items) using Apex. (i.e. something like update [Select id from QuoteLineItem where id=:quoteid] ). I get the Maximum CPU time exception.
Since triggers run in there own transaction I was under the assumtion that the trigger CPU time for the trigger would not be aggregated in the transaction where the Apex DML > 200 records is done, but this does not seem to be the case.
Can anyone shed some light on the accuracy of this aggregation and possible workarounds without using batch apex.
Since triggers run in there own transaction I was under the assumtion that the trigger CPU time for the trigger would not be aggregated in the transaction where the Apex DML > 200 records is done, but this does not seem to be the case.
Can anyone shed some light on the accuracy of this aggregation and possible workarounds without using batch apex.
Your trigger could take a very long time if allconts is a huge list of or allacc are really big!
You can use aggregate SOQL or “downwards” SOQL to make things a little simpler.
Aggregate SOQL: http://www.salesforce.com/us/developer/docs/apexcode/Content/langCon_apex_SOQL_agg_fns.htm
Downwards SOQL:
http://www.sfdc99.com/2013/06/24/example-how-to-write-a-cross-object-soql-query-part-2/
Your trigger could take a very long time if allconts is a huge list of or allacc are really big!
You can use aggregate SOQL or “downwards” SOQL to make things a little simpler.
Aggregate SOQL: http://www.salesforce.com/us/developer/docs/apexcode/Content/langCon_apex_SOQL_agg_fns.htm
Best Regards
Naga Kiran