Hi,
Salesforce provides Limit class with some methods for fetching specific limit for the particular governor such as heap size limitation or the number of APIs call of org etc. Below is the list of methods of Limit class.
-
getAggregateQueries()
Returns the number of aggregate queries that have been processed with any SOQL query statement.
-
getLimitAggregateQueries()
Returns the total number of aggregate queries that can be processed with SOQL query statements.
-
getAsyncCalls()
Reserved for future use.
-
getLimitAsyncCalls()
Reserved for future use.
-
getCallouts()
Returns the number of Web service statements that have been processed.
-
getChildRelationshipsDescribes()
Deprecated. Returns the number of child relationship objects that have been returned.
-
getLimitCallouts()
Returns the total number of Web service statements that can be processed.
-
getCpuTime()
Returns the CPU time (in milliseconds) accumulated on the Salesforce servers in the current transaction.
-
getLimitCpuTime()
Returns the time limit (in milliseconds) of CPU usage in the current transaction.
-
getDMLRows()
Returns the number of records that have been processed with any statement that counts against DML limits, such as DML statements, the Database.emptyRecycleBin method, and other methods.
-
getLimitDMLRows()
Returns the total number of records that can be processed with any statement that counts against DML limits, such as DML statements, the database.EmptyRecycleBin method, and other methods.
-
getDMLStatements()
Returns the number of DML statements (such as insert, update or the database.EmptyRecycleBin method) that have been called.
-
getLimitDMLStatements()
Returns the total number of DML statements or the database.EmptyRecycleBin methods that can be called.
-
getEmailInvocations()
Returns the number of email invocations (such as sendEmail) that have been called.
-
getLimitEmailInvocations()
Returns the total number of email invocation (such as sendEmail) that can be called.
-
getFindSimilarCalls()
Deprecated. Returns the same value as getSoslQueries. The number of findSimilar methods is no longer a separate limit, but is tracked as the number of SOSL queries issued.
-
getLimitFindSimilarCalls()
Deprecated. Returns the same value as getLimitSoslQueries. The number of findSimilar methods is no longer a separate limit, but is tracked as the number of SOSL queries issued.
-
getFutureCalls()
Returns the number of methods with the future annotation that have been executed (not necessarily completed).
-
getLimitFutureCalls()
Returns the total number of methods with the future annotation that can be executed (not necessarily completed).
-
getHeapSize()
Returns the approximate amount of memory (in bytes) that has been used for the heap.
-
getLimitHeapSize()
Returns the total amount of memory (in bytes) that can be used for the heap.
-
getMobilePushApexCalls()
Returns the number of Apex calls that have been used by mobile push notifications during the current metering interval.
-
getLimitMobilePushApexCalls()
Returns the total number of Apex calls that are allowed per transaction for mobile push notifications.
-
getQueries()
Returns the number of SOQL queries that have been issued.
-
getLimitQueries()
Returns the total number of SOQL queries that can be issued.
-
getQueryLocatorRows()
Returns the number of records that have been returned by the Database.getQueryLocator method.
-
getLimitQueryLocatorRows()
Returns the total number of records that have been returned by the Database.getQueryLocator method.
-
getQueryRows()
Returns the number of records that have been returned by issuing SOQL queries.
-
getLimitQueryRows()
Returns the total number of records that can be returned by issuing SOQL queries.
-
getQueueableJobs()
Returns the number of queueable jobs that have been added to the queue per transaction. A queueable job corresponds to a class that implements the Queueable interface.
-
getLimitQueueableJobs()
Returns the maximum number of queueable jobs that can be added to the queue per transaction. A queueable job corresponds to a class that implements the Queueable interface.
-
getRunAs()
Deprecated. Returns the same value as getDMLStatements.
-
getLimitRunAs()
Deprecated. Returns the same value as getLimitDMLStatements.
-
getSavepointRollbacks()
Deprecated. Returns the same value as getDMLStatements.
-
getLimitSavepointRollbacks()
Deprecated. Returns the same value as getLimitDMLStatements.
-
getSavepoints()
Deprecated. Returns the same value as getDMLStatements.
-
getLimitSavepoints()
Deprecated. Returns the same value as getLimitDMLStatements.
-
getSoslQueries()
Returns the number of SOSL queries that have been issued.
-
getLimitSoslQueries()
Returns the total number of SOSL queries that can be issued.
Thanks!