Governor Limits in Salesforce

Learn About the Governor Limits in Salesforce

Governor Limits are a set of rules and restrictions in Salesforce that limit the monopolistic use of cloud resources by one or more organizations that use Salesforce services. They allow several users to access the platform without slowing it down.

Governor restrictions come in a variety of shapes and sizes, some of which are connected to your Salesforce edition. For example, the Professional Edition allows for 50 custom items, whereas Unlimited and Performance allow for 2,000.

Other governor constraints have ‘soft' limits that can be overcome by Salesforce or by purchasing extra add-ons. For example, the current restriction for Apex code per org is 6MB, however, Salesforce Support can expand this on a case-by-case basis. Other restrictions are determined by a mix of your Salesforce edition and the number of user licences in your organization. Limits on APIs and data storage, for example.

dont miss out iconDon't forget to check out: Setting Up Subscription Products and Making Configuration Decisions in Salesforce CPQ

Types of Governor Limits

Restrictions for Certified Managed Packages per Transaction — If a managed package built by a Salesforce ISV has passed security review, the per-transaction limits are normally greater.

Lightning Platform Apex limit — These limits are imposed by the Lightning platform and are not particular to Apex Transactions. Users are allowed a maximum of 250,000 asynchronous Apex method executions under these restrictions.

Furthermore, for long-running transactions, the users are limited to 10 concurrent synchronous transactions. The maximum number of Apex classes that can be booked at the same time is 100. In addition, each user on the platform can have a maximum of 50 query cursors open at any given time.

Apex Limits Per-Transaction — These are the Apex Governor Limits that are utilised to count each Apex transaction that a user does. In the case of synchronous limits, the total number of SOQL queries that can be issued is limited to 100, and in the case of asynchronous limits, it is limited to 200.

The maximum number of records that can be fetched using SOQL searches has been set at 50,000. A user is also limited to issuing a maximum of 20 SOSL queries per transaction, as well as a maximum of 150 DML statements.

In any transaction, users are limited to 100 callouts, whether they be HTTP requests or web service calls. In addition, the overall heap size should not exceed 6 MB for synchronous limits and 12 MB for asynchronous limitations, according to these Governor Limits.

Static Apex Limits

Apex Limits that apply to all transactions are known as static apex limits. According to these guidelines, the default timeout for callouts in a single transaction should not exceed 10 seconds. Users must also keep callout responses under 6 MB for synchronous Apex (and 12 MB for asynchronous Apex), whether they be HTTP queries or web service calls.

Static Apex Limits limit the maximum duration for a SOQL query to 120 seconds before the Salesforce platform cancels the transaction. Apex trigger batch sizes and loop list batch sizes are both set to 200. Additionally, when deploying Apex on the platform, developers are limited to a total of 5000 class and trigger code units.

Governor Limits Importance

Governor Limits are an important topic for all Salesforce Developers (and, to a lesser extent, Admins). When a Salesforce Governor Limit is reached, the corresponding governor throws an unhandled runtime exception. That is to say, your code is broken and will not work.

dont miss out iconCheck out another amazing blog by Sandeep here: Validation Rules in Salesforce - Get Started

Following are the Procedure for Adhering to the Governor's Restrictions

  1. Bulkify your code
  1. In FOR Loops, do not use SOQL queries DML statements
  1. Using efficient FOR Loops, collections and streamlining queries
  1. Querying large data sets
  1. IDs should not be hardcoded


Popular Salesforce Blogs