Home / Salesforce

Governor Limits in Salesforce

Rating: 4.0Blog-star
Views: 24322
by Arogyalokesh
Last modified: May 28th 2021

Salesforce has governor limits to assure the practical usage of the resources present in the Force.com platform. To use the code effectively, salesforce establishes some limits, and they are known as Governor limits.

 

In this article, you'll learn
  • What are Governor Limits
  • Why Governor Limits
  • Types of Governor Limits in Salesforce
  • Benefits of Governor Limits in Salesforce
  • How to handle Governor Limits in Salesforce

 

What are the Governor Limits in Salesforce

Why Governor Limits

To assure that nobody gains requirements from other people, Force.com establishes many constraints that restrict standard code implementation. Salesforce will do this as it has multi-tenant architecture, because of which every organization and user share the same resource. 

If any governor limit is not satisfied, an error has occurred, further, the program is stopped or halted. So, it is critical to assure that code is extensible and should not violate any governor limits. This type of limit is known as a single transaction basis.

 

Want to enhance your skills in dealing with the world's best CRM, enroll in our Online Salesforce Training

 

Different kinds of Governor limits

1. Per-transaction certified managed Package Limits.

These managed packages are those that have passed AppExchange security checks for majority transaction limits. These managed packages are designed by salesforce ISV Partners and set up in our organization through AppExchange within a single namespace.

We can access any amount of certified namespaces with the help of a single transaction. Though, the precondition is that the number of operations that can be carried out in a separate namespace should not surpass the per-transaction limits.

Moreover, the operations which can be carried out in the transaction throughout the namespace is restricted. For each namespace the overall limit is 11times. 

Every transaction limits count separately for certified managed packets anticipate

  • Effective CPU utilization.
  • Complete heap size
  • Numerous unique namespaces
  • Best transaction implementation time.

All the restrictions mentioned above apply to all transactions, still if the amount of certified managed packages working in the same transaction. When we set up an AppExchange package generated by an unauthorized Salesforce ISV partner, the code part of that specific package won’t have its governor limits.

2. Static Apex Limits

Till now, we are aware of various governor limits corresponding to every description given in apex. We observe additional governor limits i.e. for various types of callouts, loops, queries, and records together with multiple transactions.

Description Limits
The callouts default timeout for every transaction 10 seconds
callout request or response maximum size 6 to 12 MegaBytes.
Maximum SOQL runtime prior salesforce abolishes transaction 2 Minutes
The maximum amount of trigger code units and classes in the apex implementation 5,000
Batch size of apex trigger 200
Batch size of For loop list 200
A number of records reverted for a batch apex query within Database.queryLocator 50 million

3. Per transaction apex limits

These limits are useful for counting every apex transaction. While we discuss batch apex, limits which are present for executing records batch are reactivated.  

Description Synchronous limits Asynchronous limits
Total SOQL Queries used 100 200
SOQL Queries retrieved records 50,000  
Issued SOSL Queries 20  
Issued DML Statements 150  
The total amount of callouts per transaction 100  
Allowed send email Methods 10  
Apex transaction execution time 10 minutes  
  Salesforce Servers CPU time 10,000 60,000 

4. Lightning Platform apex limits

The below-mentioned limits are not applicable for apex transactions, so the lightning platform handles these limits.

Description Limit
The maximum amount of asynchronous method executions in 24 hours 25,000 
Parallelly scheduled apex classes 100. 
Queued apex jobs or active parallelly 5
The maximum amount of batches submitted 5
Parallelly opened query cursors  per user  50
Parallelly opened query cursors  per user  15

5. Size-specific Apex Limits

Depending on the size these limits are particularly designed to assure that no outsized items are present in the classes.

The following table provides the limits of size-specific apex limits

Description Limit
The maximum amount of characters per class 1 mn
The maximum amount of triggers per class 1 million
Apex maximum code utilization 6MB
Limit 2 of methode size 65,535 

Benefits of Governor Limits

Apex has entirely different or individual coding limits.

Governor limits assist us to stay within the appropriate place of apex coding.

How to avoid Governor Limits

We can avoid governor limits by the following process

  • Avoid DML Statements and SOQL queries within the For Loop
  • Make sure that the apex code manages more than one record at a time.
  • For loops, we should use collections.
  • Streamline different triggers over the same page.
Explore Salesforce Sample Resumes! Download & Edit, Get Noticed by Top Employers! Download Now!

About Author

author
NameArogyalokesh
Author Bio

Arogyalokesh is a Technical Content Writer and manages content creation on various IT platforms at Mindmajix. He is dedicated to creating useful and engaging content on Salesforce, Blockchain, Docker, SQL Server, Tangle, Jira, and few other technologies. Get in touch with him on LinkedIn and Twitter.