Salesforce Governor Limits  | List of Governor Limits in Salesforce.

In this Salesforce developer tutorial we are going to learn about Salesforce Governor Limits, Limitations of Salesforce Governor Limits and how to set up governor limit email warning in Salesforce?

What is a Governor Limit in Salesforce?

Salesforce Governor Limits are the run time limits that are apply in order to have some performance to the database since it runs on multi tenancy environment.

List of Salesforce Governor Limits.

  • Only one batch apex job’s start method can run at a time in an organization.
  • Up to 5 queued or active batch jobs are allowed for apex.
  • Maximum 2,50,000 batch apex method executed per a 24 hour period.
  • The batch apexstart method can have up to 15 query cursors open at a time per user.
  • Maximum of 50 million record can be returned in the database. Querylocator object.
  • Maximum number of SOSL Queries – only 20.
  • Maximum number of SOQL Queries – 100.
  • No of DML statements – 150.
  • No of record written by a query – 50000.
  • maximum number of DML rows – 10,000.
  • Maximum number of script statements – 2,00,000.
  • Maximum heap size – 6MB.
  • Maximum number of call outs – 10.
  • Maximum number of future calls – 10.
  • Maximum number of picklist describe – 10.
  • Maximum number of record type describe – 100.
  • Maximum number of relationship describe – 100.
  • Maximum number of fields describe – 100.
  • Maximum number of Email invocations – 10.

Note :- If we have 1000 records with scope of 200 records then they are divided into 5 batches.

Limitations:- 

  • Methods declared as future aren’t allowed in the classes that implement Database. Batchable interface.
  • Methods declared as future can’t be called from Batch Apex class.
  • For sharing recalculations, we recommend that the execute method delete and then re-create all Apex manages sharing for the records in the batch.

How to Overcome Governor limits in Salesforce?

To overcome Salesforce Governor Limits a special care must be taken while writing code.

  1. Never make any SOQL and DML operation inside the loop.
  2. Use les number of script statements.
  3. Use batch apex, when working with above 50000 records.
  4. Use @future.
  5. Use Batch Apex.
  6. Use Annotations.
  7. Use for loop.
  8. Using ‘in’ clause.
ADVERTISEMENT

How to set up governor limit email warning in Salesforce?

We can specify user’s to receive an email notification when they invoke Apex code that surpasses 50% of allocated Salesforce Governor Limits. Follow the steps given below to set up governor limit email warning in Salesforce.

  • Go to Setup | Administer | Manage users | Users | Edit
Salesforce Governor limits

To activate send Apex Warning Emails check box user must have administrator profile. If not we can not activate send Apex warning Emails in Salesforce.

Click here :- Download list of Governor limits in Salesforce PDF file.