Hi
The time taken by the apex transaction in a context including validations,workflows apex code and excluding time taken in DML,queries,callouts is called CPU time .
below is the list that will be taken into account for calculating CPU time
- All Apex code
- Library function exposed in Apex
- workflow Execution
below is the list that will not be taken into Account
- DatabaseOperation eg: soql,DML
- SOSL
- HTTP callouts.
If you get this error, it is because your apex code is not efficient, so follow the best practice to write the code.
like
you can avoid so many conditions inside the for loop.
reduce the for loop.
CPU time Limits
Synchronous - 10,000 ms
Asynchronous - 60,000 ms
below are the methods where we can get the CPU time and CPU limit.
Limits.getCPUTime() - Returns the CPU time(in milliseconds) accumulated on the salesforce.com server in the current transaction.
Limits.getLimitCPUTime() - Returns the total CPU time (in milliseconds) accumulated on the salesforce.com servers in the current transaction.
The time taken by the apex transaction in a context including validations,workflows apex code and excluding time taken in DML,queries,callouts is called CPU time .
below is the list that will be taken into account for calculating CPU time
- All Apex code
- Library function exposed in Apex
- workflow Execution
below is the list that will not be taken into Account
- DatabaseOperation eg: soql,DML
- SOSL
- HTTP callouts.
If you get this error, it is because your apex code is not efficient, so follow the best practice to write the code.
like
you can avoid so many conditions inside the for loop.
reduce the for loop.
CPU time Limits
Synchronous - 10,000 ms
Asynchronous - 60,000 ms
below are the methods where we can get the CPU time and CPU limit.
Limits.getCPUTime() - Returns the CPU time(in milliseconds) accumulated on the salesforce.com server in the current transaction.
Limits.getLimitCPUTime() - Returns the total CPU time (in milliseconds) accumulated on the salesforce.com servers in the current transaction.
No comments:
Post a Comment