OrgLimits Class

Contains methods that provide a list or map of all OrgLimit instances for Salesforce your org, such as SOAP API requests, Bulk API requests, and Streaming API limits.

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.

OrgLimits Methods

The following are methods for OrgLimits.

getAll()

Returns a list of OrgLimit instances.

Signature

public static List<System.OrgLimit> getAll()

Return Value

Type: List<System.OrgLimit>

getMap()

Returns a map of all OrgLimit instances with the limit name as key.

Signature

public static Map<String,System.OrgLimit> getMap()

Return Value

Type: Map<String,System.OrgLimit>

Example

Map<String,System.OrgLimit> limitsMap = OrgLimits.getMap();
System.OrgLimit apiRequestsLimit = limitsMap.get('DailyApiRequests');
System.debug('Limit Name: ' + apiRequestsLimit.getName());
System.debug('Usage Value: ' + apiRequestsLimit.getValue());
System.debug('Maximum Limit: ' + apiRequestsLimit.getLimit());