Salesforce CRM is undeniably becoming omnipresent owing to the versatility; it has to fit in the demands of all types or scales of operations & functioning for diverse domains across the industry sector.
Salesforce has been winning hearts across all sizes of businesses for more than two decades now.
When businesses think of efficiently managing the customer base, the first name to strike their minds is Salesforce- without any doubt.
Designing, building and customizing Salesforce according to the need of every size & type of business is possible and that makes it most-sought after CRM software.
These tasks of designing, building or customizing this CRM for business however is done by Salesforce Developers.
They understand the business needs and then make salesforce platform, tools as well as the application function as per the business needs.
Nonetheless, the tasks which Salesforce Developer perform are linked to some restrictions as well as regulations.
While making some pivotal changes in the system, there are some important regulations which need to be kept in mind by the Salesforce Developers. These rules, are majorly called as Governor Limits.
Have you been wondering about Governor Limits?
Do you think you need some basic understanding to go about with the services related to Salesforce?
Well, to answer these and many more pertinent questions, let us quickly dive deep into these concepts explained in a lucid manner here:
- We will first focus on the Multitenant Architecture and understand its relation with the Salesforce Governor Limits.
- Then we will jump straight to understand what is Salesforce Governor Limits?
- And we would be in a state to talk about Types of Salesforce Governor Limits.
- Then before we conclude the blog, we will talk about best ways to avoid Salesforce Governor limits as well as the benefits offered by Governor Limits.
So let us quickly roll out an elaborate concept to understand Multitenant Architecture:
Understanding the concept of Multitenant Architecture?
In the simplest words, we can say that when a software platform, or rather say a single software platform, is being used by many or multiple users, it can be termed as a multitenant architecture.
Such is the case with Salesforce CRM as well, owing to the fact that all the users or operators utilize the same version or the same architecture for Salesforce platform.
There is another term, single-tenant platforms and the difference between multitenant platforms and former is that the later needs to be upgraded by the users for themselves on a regular basis.
The multitenant platforms send regular updates to its users.
However, when it comes to Salesforce, it is a cloud-based CRM hence users do not have to put efforts on maintaining the software as well as hardware of the Salesforce Platform.
And since, Salesforce is a multitenant architecture platform, the users get the latest versions installed in their systems.
In order to maintain such a platform, Salesforce has certain set of rules in order restrict monopolistic use of this platform.
What are these rules, how do they work or what are their types and much more; let us read about all of these:
What are the Salesforce Governor Limits?
In simpler terms, in order to make sure that the platform is not misused by anyone, as there are multiple users on the same server, Salesforce enforces certain caps on the usage of the platform.
Hence, multiple users can use the platform without affecting the overall performance.
There is a list of various types of Salesforce Governor Limits.
Some of these types have soft limits while other have a combination of programming in Apex Language, known as hard limits.
The governor limits which are soft, can be solved by Salesforce or by certain paid add-ons.
For instance, when the limit is 6 MB of Apex code per org, it is a soft limit and it can be extended depending on your case with the help of Salesforce Support.
While the other types of limits, you might need awareness on API and data storage limits.
For hard limits, developer needs to find a way out in order to get the results as the limits cannot be increased in these cases.
Let us read about all such types of Salesforce Governance:
Types of Salesforce Governor Limits
The types are classified based on various factors, but here we have listed more of them along with other related details as well.
The types of Salesforce Governance are:
Per-Transaction Apex Limits – These limits count for each Apex transaction.
For Batch Apex, these limits are reset for each execution of a batch of records in the execute method.
- Per Transaction Certified Managed Package Limits
- Lightning Platform Apex Limit
- Static Apex Limit
- Size-Specific Apex Limit
- Miscellaneous Apex Limit
Let us talk deeply about these various types of Salesforce governor limits for different security levels and other metrics related to code.
Per-transaction Certified Managed Package Limits
This type is relevant when the AppExchange checks have been cleared for the majority of transaction limits.
The Certified Managed Package is developed by ISV partners and installation is done from AppExchange with a unique namespace.
Other details include:
|Total SOQL queries issued||1100|
|Total retrieved records by Database.getQueryLocator||110000|
|Number of SOSL queries issued||220|
|Total DML statements issued||1650|
|Total Callouts in a transaction||1100|
|Toal sendEmail methods allowed||110|
Static Apex Limits
The governor limits by Salesforce has different limits for each Apex description.
The limits included in static apex comprise different types of callouts, loops, queries, batch sizes, and transactions.
The limit details for each type are mentioned below:
|The default timeout for transaction callouts||10 seconds|
|Max. size of callout request or response||6MB (Synchronous)
12 MB ( Asynchronous)
|SOQL query runtime before cancellation of a transaction||120 seconds|
|Max. number of class and trigger units of code||5000|
|Trigger batch size for Apex||200|
|Size of loop list batch||200|
|Batch Apex query returned records in Database.QueryLocator||50 million|
Per-transaction Apex Limits
These limitations are designed for counting all Apex transactions.
The limits for both synchronous and asynchronous Apex are mentioned below:
|Factor||Synchronous Limit||Asynchronous Limit|
|Total SOQL queries issued||100||200|
|Total records retrieved by SOQL queries||50,000|
|Total records retrieved by Database.getQueryLocator||10,000|
|Total SOSL queries issued||20|
|Records retrieved by a single SOSL query||20,000|
|Toal DML statements issued||150|
|Total records processed by DML statements||10,000|
|Stack depth for Apex invocation||16|
|Total callots in a transaction||100|
|Methods allowed per Apex invocation||50||0 in batch & future contexts, 1 in queueable context|
|Number of Apex jobs added||50||1|
|Toal sendEmail methods allowed||10|
|Total heap size||6 MB||12 MB|
|Max. CPU time on Salesforce servers||10,000 milliseconds||60,000 milliseconds|
|Execution time for Apex transaction||10 minutes|
|Max. push notifications per Apex transaction||10|
|Max push notifications send through each push notification method call||2000|
Lightning Platform Apex Limits
The lightning platform is responsible for the handling of the following limits:
|The maximum amount of asynchronous method executions per day||25,000|
|Parallelly scheduled apex classes||100|
|Queued Apex jobs||5|
|Max. batches submitted||5|
|Parallelly opened query cursors/user||50|
|Parallelly opened query cursors/user||15|
Size-specific Apex Limits
This type serves the purpose of keeping a check on outsized items in classes.
The limitations for size-specific elements include:
|The maximum amount of characters/ class||1 mn|
|The maximum amount of triggers/ class||1 Million|
|Apex maximum code utilization||6 MB|
|Limit for method size||65,535|
Best Practices to follow to avoid Governor limits
Well, there has to be some practices which can be followed to avoid such limits!?
Yes, of course, our experts have listed some of these for you, let us have a look at these:
- You can try to bulkify your code and the helper method
- You are advised to avoid SOQL queries or DML statements in FOR loops
- You can use Collections, Streamlining Queries, and Efficient for Loops
- Go with Querying Large Data Sets
- Streamline Multiple Triggers on the Same Object
- Do not use any SOQL, DML operation inside the loop.
- Use Limits Apex Methods to Avoid Hitting Governor Limits
- Use @future Appropriately
- Use batch apex if you are working for more than 50000 records.
Benefits of Salesforce Governance limits
You might be wondering that why one needs to understand these terms, and ways to avoid these limits!
Are there some advantages offered by Salesforce Governor limits?
Well, there are pretty many benefits offered by such limits. These benefits are:
- In order to help save space in the entire cloud CPU or in the memory itself, these limits do not let other org use or execute lengthy code.
- Apex has totally unique and different coding limits considering job security.
- These governor limits help to stay the correct space of coding with Apex.
Overall, it can be said that Salesforce Governor limits, aid in writing codes which are efficient and scalable.
Finally, it could be said that while writing the code, it is important to consider the limits of Salesforce.
It can simply help you in many ways, and you can eventually come out with codes which are efficient.
In case you still have queries and questions, and need some expert to helping you with these; feel free to contact us.
We have a team of developers and experts looking forward to help you with the right solutions.