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:
myDMLLimit = 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.
The following are methods for Limits. All methods are static.
public static Integer getAggregateQueries()
Type: Integer
public static Integer getLimitAggregateQueries()
Type: Integer
public static Integer getLimitAsyncCalls()
Type: Integer
public static Integer getCallouts()
Type: Integer
public static Integer getLimitCallouts()
Type: Integer
public static Integer getChildRelationshipsDescribes()
Type: Integer
public static Integer getLimitChildRelationshipsDescribes()
Type: Integer
public static Integer getCpuTime()
Type: Integer
public static Integer getLimitCpuTime()
Type: Integer
public static Integer getDMLRows()
Type: Integer
public static Integer getLimitDMLRows()
Type: Integer
public static Integer getDMLStatements()
Type: Integer
public static Integer getLimitDMLStatements()
Type: Integer
public static Integer getEmailInvocations()
Type: Integer
public static Integer getLimitEmailInvocations()
Type: Integer
public static Integer getFieldsDescribes()
Type: Integer
public static Integer getLimitFieldsDescribes()
Type: Integer
public static Integer getFieldSetsDescribes()
Type: Integer
public static Integer getLimitFieldSetsDescribes()
Type: Integer
public static Integer getFindSimilarCalls()
Type: Integer
public static Integer getLimitFindSimilarCalls()
Type: Integer
public static Integer getFutureCalls()
Type: Integer
public static Integer getLimitFutureCalls()
Type: Integer
public static Integer getHeapSize()
Type: Integer
public static Integer getLimitHeapSize()
Type: Integer
public static Integer getMobilePushApexCalls()
Type:Integer
public static Integer getLimitMobilePushApexCalls()
Type:Integer
public static Integer getPicklistDescribes()
Type: Integer
public static Integer getLimitPicklistDescribes()
Type: Integer
public static Integer getQueries()
Type: Integer
public static Integer getLimitQueries()
Type: Integer
public static Integer getQueryLocatorRows()
Type: Integer
public static Integer getLimitQueryLocatorRows()
Type: Integer
public static Integer getQueryRows()
Type: Integer
public static Integer getLimitQueryRows()
Type: Integer
public static Integer getQueueableJobs()
Type: Integer
public static Integer getLimitQueueableJobs()
Type: Integer
public static Integer getRecordTypesDescribes()
Type: Integer
public static Integer getLimitRecordTypesDescribes()
Type: Integer
public static Integer getRunAs()
Type: Integer
The number of RunAs methods is no longer a separate limit, but is tracked as the number of DML statements issued.
public static Integer getLimitRunAs()
Type: Integer
The number of RunAs methods is no longer a separate limit, but is tracked as the number of DML statements issued.
public static Integer getSavepointRollbacks()
Type: Integer
The number of Rollback methods is no longer a separate limit, but is tracked as the number of DML statements issued.
public static Integer getLimitSavepointRollbacks()
Type: Integer
The number of Rollback methods is no longer a separate limit, but is tracked as the number of DML statements issued.
public static Integer getSavepoints()
Type: Integer
The number of setSavepoint methods is no longer a separate limit, but is tracked as the number of DML statements issued.
public static Integer getLimitSavepoints()
Type: Integer
The number of setSavepoint methods is no longer a separate limit, but is tracked as the number of DML statements issued.
public static Integer getScriptStatements()
Type: Integer
public static Integer getLimitScriptStatements()
Type: Integer
public static Integer getSoslQueries()
Type: Integer
public static Integer getLimitSoslQueries()
Type: Integer