You need to sign in to do that
Don't have an account?
Daniel K
First Error: Apex CPU Limit Exceeded
Hi All,
Today I got "First Error: Apex CPU Limit Exceeded" error while executing batch apex.
Not even a single batch got completed, below is the status of Apex Job.
As it has failed in the first step itself, should we consider the failure is at START method ?
Thanks
Today I got "First Error: Apex CPU Limit Exceeded" error while executing batch apex.
Not even a single batch got completed, below is the status of Apex Job.
As it has failed in the first step itself, should we consider the failure is at START method ?
Job Type Status Status Detail Total Batches Batches Processed Failures ---------- ------- ----------------------------------------- -------------- ----------------- -------- Batch Apex Failed First error: Apex CPU time limit exceeded 0 1 1
Thanks
String query = ' SELECT Field1, Field2, (SELECT Name, Identifier__c FROM childObject__r Where type=\'some value\') FROM Contact';
global Database.QueryLocator start(Database.BatchableContext BC) {
return Database.getQueryLocator(query);
}
global void execute(Database.BatchableContext BC, List<Contact> contacts) {
//code
}
global void finish(Database.BatchableContext BC) {
//code
}
}
I think u should share the code so that we can help more better
Thanks
Saket Sharma
You are getting the CPU time error mostly because you are lot of inner queries in your class.
You can try decreasing the batch size to say 50 and try running the batch again.
Here is a documentation provided by Salesforce to avoid the error :
https://help.salesforce.com/articleView?id=000232681&language=en_US&type=1