Reader small image

You're reading from  Apex Design Patterns

Product typeBook
Published inApr 2016
Reading LevelBeginner
Publisher
ISBN-139781782173656
Edition1st Edition
Languages
Right arrow
Authors (2):
Anshul Verma
Anshul Verma
author image
Anshul Verma

Anshul Verma has been working on the Salesforce platform since 2006. Prior to that, he has done extensive development using MS technologies on web, desktop, and mobile applications. He possesses a tremendous understanding of enterprise-scale systems and has worked in designing intricate systems with high scalability, performance, and robustness. He has been a Dreamforce speaker and is a regular contributor to Stack Exchange and other developer communities. He has four Salesforce certifications and is currently working as a project manager and technical architect where he is responsible for managing customer success and delivering high-quality solutions to his clients. He has conducted various training sessions in his current organization and trained over 50 new hires. He is very popular with his training batches and can be often found sharing his knowledge with his team and peers. He owns and maintains his blog (http://mightycoder.blogspot.com/), and you can follow him on Twitter at @toanshulverma.
Read more about Anshul Verma

Jitendra Zaa
Jitendra Zaa
author image
Jitendra Zaa

Jitendra Zaa has been working on the Salesforce platform since 2008. He has extensively worked on Java and .NET-based enterprise applications. He also has experience in working with multiple JavaScript libraries, web frameworks, ETL tools, and databases. He is an expert in designing and implementing integrations of Salesforce with external systems. He is a regular speaker at the worlds biggest developer event, Dreamforce, mostly in developer track. Because of his contributions to the Salesforce community, he has also been awarded the Salesforce MVP title. He has more than eight Salesforce certifications and works as a Salesforce technical architect. He owns one of the most viewed Salesforce developer blogs (http://www.JitendraZaa.com), formerly, http://Shivasoft.in. You can follow him on Twitter at @JitendraZaa.
Read more about Jitendra Zaa

View More author details
Right arrow

SOQL inside a loop


Salesforce being a multi-tenant cloud platform, monitors each tenant's (organization's) process load, data usage, and so on to ensure that no tenant can cause an impact on the other tenants' processes. To achieve this, Salesforce imposes governor limits. Governor limits define the system usage allowance available to each tenant and ensures that any tenant crossing those limits is restricted to further impact the system. One such transaction level Apex limit is total number of SOQL queries issued in a single request. At present, the limit is 100 for synchronous transactions (Apex methods and triggers) and 200 for asynchronous transactions (batch Apex, future methods, and so on). So, if your code issues even one extra SOQL than the allowed limit within the code, then Salesforce will throw a governor limit exception.

For example, the following code is an Apex trigger built to automatically populate the value of an SLA field on a Contact record by taking its values from the...

lock icon
The rest of the page is locked
Previous PageNext Page
You have been reading a chapter from
Apex Design Patterns
Published in: Apr 2016Publisher: ISBN-13: 9781782173656

Authors (2)

author image
Anshul Verma

Anshul Verma has been working on the Salesforce platform since 2006. Prior to that, he has done extensive development using MS technologies on web, desktop, and mobile applications. He possesses a tremendous understanding of enterprise-scale systems and has worked in designing intricate systems with high scalability, performance, and robustness. He has been a Dreamforce speaker and is a regular contributor to Stack Exchange and other developer communities. He has four Salesforce certifications and is currently working as a project manager and technical architect where he is responsible for managing customer success and delivering high-quality solutions to his clients. He has conducted various training sessions in his current organization and trained over 50 new hires. He is very popular with his training batches and can be often found sharing his knowledge with his team and peers. He owns and maintains his blog (http://mightycoder.blogspot.com/), and you can follow him on Twitter at @toanshulverma.
Read more about Anshul Verma

author image
Jitendra Zaa

Jitendra Zaa has been working on the Salesforce platform since 2008. He has extensively worked on Java and .NET-based enterprise applications. He also has experience in working with multiple JavaScript libraries, web frameworks, ETL tools, and databases. He is an expert in designing and implementing integrations of Salesforce with external systems. He is a regular speaker at the worlds biggest developer event, Dreamforce, mostly in developer track. Because of his contributions to the Salesforce community, he has also been awarded the Salesforce MVP title. He has more than eight Salesforce certifications and works as a Salesforce technical architect. He owns one of the most viewed Salesforce developer blogs (http://www.JitendraZaa.com), formerly, http://Shivasoft.in. You can follow him on Twitter at @JitendraZaa.
Read more about Jitendra Zaa