Newer Version Available
Limits Class
Namespace
Usage
The Limits methods return the specific limit for the particular governor, such as the number of calls of a method or the amount of heap size remaining.
Because Apex runs in a multitenant environment, the Apex runtime engine strictly enforces a number of limits to ensure that runaway Apex doesn’t monopolize shared resources.
None of the Limits methods require an argument. The format of the limits methods is as follows:
1myDMLLimit = Limits.getDMLStatements();There are two versions of every method: the first returns the amount of the resource that has been used while the second version contains the word limit and returns the total amount of the resource that is available.
Limits Methods
The following are methods for Limits. All methods are static.
getAggregateQueries()
Signature
public static Integer getAggregateQueries()
Return Value
Type: Integer
getLimitAggregateQueries()
Signature
public static Integer getLimitAggregateQueries()
Return Value
Type: Integer
getLimitAsyncCalls()
Signature
public static Integer getLimitAsyncCalls()
Return Value
Type: Integer
getCallouts()
Signature
public static Integer getCallouts()
Return Value
Type: Integer
getChildRelationshipsDescribes()
Signature
public static Integer getChildRelationshipsDescribes()
Return Value
Type: Integer
Usage
getLimitCallouts()
Signature
public static Integer getLimitCallouts()
Return Value
Type: Integer
getCpuTime()
Signature
public static Integer getCpuTime()
Return Value
Type: Integer
getLimitCpuTime()
Signature
public static Integer getLimitCpuTime()
Return Value
Type: Integer
getDMLRows()
Signature
public static Integer getDMLRows()
Return Value
Type: Integer
getLimitDMLRows()
Signature
public static Integer getLimitDMLRows()
Return Value
Type: Integer
getDMLStatements()
Signature
public static Integer getDMLStatements()
Return Value
Type: Integer
getLimitDMLStatements()
Signature
public static Integer getLimitDMLStatements()
Return Value
Type: Integer
getEmailInvocations()
Signature
public static Integer getEmailInvocations()
Return Value
Type: Integer
getLimitEmailInvocations()
Signature
public static Integer getLimitEmailInvocations()
Return Value
Type: Integer
getFindSimilarCalls()
Signature
public static Integer getFindSimilarCalls()
Return Value
Type: Integer
getLimitFindSimilarCalls()
Signature
public static Integer getLimitFindSimilarCalls()
Return Value
Type: Integer
getFutureCalls()
Signature
public static Integer getFutureCalls()
Return Value
Type: Integer
getLimitFutureCalls()
Signature
public static Integer getLimitFutureCalls()
Return Value
Type: Integer
getHeapSize()
Signature
public static Integer getHeapSize()
Return Value
Type: Integer
getLimitHeapSize()
Signature
public static Integer getLimitHeapSize()
Return Value
Type: Integer
getMobilePushApexCalls()
Signature
public static Integer getMobilePushApexCalls()
Return Value
Type:Integer
getLimitMobilePushApexCalls()
Signature
public static Integer getLimitMobilePushApexCalls()
Return Value
Type:Integer
getPublishImmediateDML()
Signature
public static Integer getPublishImmediateDML()
Return Value
Type: Integer
getLimitPublishImmediateDML()
Signature
public static Integer getLimitPublishImmediateDML()
Return Value
Type: Integer
getQueries()
Signature
public static Integer getQueries()
Return Value
Type: Integer
getLimitQueries()
Signature
public static Integer getLimitQueries()
Return Value
Type: Integer
getQueryLocatorRows()
Signature
public static Integer getQueryLocatorRows()
Return Value
Type: Integer
getLimitQueryLocatorRows()
Signature
public static Integer getLimitQueryLocatorRows()
Return Value
Type: Integer
getQueryRows()
Signature
public static Integer getQueryRows()
Return Value
Type: Integer
getLimitQueryRows()
Signature
public static Integer getLimitQueryRows()
Return Value
Type: Integer
getQueueableJobs()
Signature
public static Integer getQueueableJobs()
Return Value
Type: Integer
getLimitQueueableJobs()
Signature
public static Integer getLimitQueueableJobs()
Return Value
Type: Integer
getRunAs()
Signature
public static Integer getRunAs()
Return Value
Type: Integer
Usage
The number of RunAs methods is no longer a separate limit, but is tracked as the number of DML statements issued.
getLimitRunAs()
Signature
public static Integer getLimitRunAs()
Return Value
Type: Integer
Usage
The number of RunAs methods is no longer a separate limit, but is tracked as the number of DML statements issued.
getSavepointRollbacks()
Signature
public static Integer getSavepointRollbacks()
Return Value
Type: Integer
Usage
The number of Rollback methods is no longer a separate limit, but is tracked as the number of DML statements issued.
getLimitSavepointRollbacks()
Signature
public static Integer getLimitSavepointRollbacks()
Return Value
Type: Integer
Usage
The number of Rollback methods is no longer a separate limit, but is tracked as the number of DML statements issued.
getSavepoints()
Signature
public static Integer getSavepoints()
Return Value
Type: Integer
Usage
The number of setSavepoint methods is no longer a separate limit, but is tracked as the number of DML statements issued.
getLimitSavepoints()
Signature
public static Integer getLimitSavepoints()
Return Value
Type: Integer
Usage
The number of setSavepoint methods is no longer a separate limit, but is tracked as the number of DML statements issued.
getSoslQueries()
Signature
public static Integer getSoslQueries()
Return Value
Type: Integer
getLimitSoslQueries()
Signature
public static Integer getLimitSoslQueries()
Return Value
Type: Integer