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.\
Example of second version methods:
- System.debug('Limit Aggregate'+System.limits.getLimitAggregateQueries());
- System.debug('Limit Callout'+System.limits.getLimitCallouts());
- System.debug('Limit Child Describe'+System.limits.getLimitChildRelationshipsDescribes());
- System.debug('CPU Time'+System.limits.getLimitCpuTime());
- System.debug('Limit DML Rows'+System.limits.getLimitDMLRows());
- System.debug('Limit DML Statements'+System.limits.getLimitDMLStatements());
- System.debug('Limit Email Invocation'+System.limits.getLimitEmailInvocations());
- System.debug('Field Describe'+System.limits.getLimitFieldsDescribes());
- System.debug('Field Set Describe'+System.limits.getLimitFieldSetsDescribes());
- System.debug('Limit find similar call'+System.limits.getLimitFindSimilarCalls());
- System.debug('Future calls'+System.limits.getLimitFutureCalls());
- System.debug('Limit heap size'+System.limits.getLimitHeapSize());
- System.debug('Limit queries'+System.limits.getLimitQueries());
- System.debug('Picklist Describe'+System.limits.getLimitPicklistDescribes());
- System.debug('Limit Query Locator'+System.limits.getLimitQueryLocatorRows());
- System.debug('Limit Query Rows'+System.limits.getLimitQueryRows());
- System.debug('Limit Record Types'+System.limits.getLimitRecordTypesDescribes());
- System.debug('Limit RunAs'+System.limits.getLimitRunAs());
- System.debug('Limit Save Point Rollback'+System.limits.getLimitSavepointRollbacks());
- System.debug('Limit Save Point'+System.limits.getLimitSavepoints());
- System.debug('Limit Script Methods'+System.limits.getLimitScriptStatements());
- System.debug('Limit SOSL Queries'+System.limits.getLimitSoslQueries());
No comments:
Post a Comment