OrgLimit Class

Contains methods that provide the name, maximum value, and current value of an org limit.

Namespace

System

Usage

Use the System.OrgLimits getAll and getMap methods to obtain either a list or a map of all your org limits. To get details on each limit, use instance methods from System.OrgLimit.

For comparison, the Limits Class returns Apex governor limits and not Salesforce API limits.

Note

Note

Limit values are updated asynchronously, in near-real-time.

OrgLimit Methods

The following are methods for OrgLimit.

getLimit()

Returns the maximum allowed limit value.

Signature

public Integer getLimit()

Return Value

Type: Integer

Example

List<System.OrgLimit> limits = OrgLimits.getAll();
for (System.OrgLimit aLimit: limits) {
    System.debug('Limit: ' + aLimit.getName());
    System.debug('Max Limit is: ' + aLimit.getLimit());
}

getName()

Returns the limit’s name.

Signature

public String getName()

Return Value

Type: String

Example

List<System.OrgLimit> limits = OrgLimits.getAll();
for (System.OrgLimit aLimit: limits) {
    System.debug('Limit: ' + aLimit.getName());
    System.debug('Max Limit is: ' + aLimit.getLimit());
}

getValue()

Returns the limit usage value.

Signature

public Integer getValue()

Return Value

Type: Integer

Example

List<System.OrgLimit> limits = OrgLimits.getAll();
for (System.OrgLimit aLimit: limits) {
    System.debug('Limit: ' + aLimit.getName());
    System.debug('Usage Value is: ' + aLimit.getValue());
}

toString()

Returns the string representation of the org limit.

Signature

public String toString()

Return Value

Type: String

String denoting the name, current consumption, and maximum value of the org limit. For example:
OrgLimit[DailyBulkApiBatches: consumed 25 of 15000]