Share:|

Hi, I’m new here.

 

Not to the Internet, mind, or Remedyforce but to BMC community blogging. I’ve been with BMC since 2011, however this is a new social platform and new audience for me although some may who know me verbally through Remedyforce Support, so I figured I should do a quick post to introduce myself and the kind of thing that I do.

 

I’ve been here at BMC for almost 5 wonderful years and have spent the last couple of years working closely with Remedyforce customers as a Remedyforce Technical Support Specialist and Subject Matter Expert. It’s been exciting and each day presents challenges with opportunities to learn something new, to help our customers in resolving issues and to make them Smile  Aside from work I like to spend time with family, friends, working on fitness and nutrition.

 

Lets move on to the main topic Too many SOQL queries: 101

 

Lets Transform the way you see SOQL queries message warning of in Salesforce


1.PNG

 

Let's first see what is SOQL queries and why do we receive it:

 

A SOQL is similar to the SELECT statement in the widely used Structured Query Language (SQL) but is designed specifically for Salesforce data and what action to perform depending on this select statement but receiving a " Too many SOQL queries: 101 " message in Salesforce is a warning that we have reached above the governor limit of 100 SOQL queries per transaction for synchronous transaction and for an asynchronous transaction, 200 SOQL queries are issued..


How to find out where the limit is crossed:


To find out the real cause of the issue which query has crossed the limit it can be identified with the debug log only.

From the debug logs, we can find out the flow of execution, verifying at first level what is causing the issue, and so on.

1.Custom Code/Trigger

2.Approval Process

3.Workflow rules

4.Flows or Process builder

5.Roll-up summary fields


A quick tip of the month for best practices to avoid hitting the Governor limit :

 

1. Since Apex runs on a Multitenant structure, Apex run-time engine strictly enforces limits to ensure code doesn't monopolize shared resources.

2.Avoid SOQL queries that are inside FOR loop.

3.Be sure you're following the key coding principals for Apex Code

4.when performing bulk operations on Objects do deactivate Process (or Flow Trigger).

5.Where possible, remove any unnecessary elements from the Process (for example, if you have 2 Record Update actions on the same record, you may be able to consolidate these into a single Record Update action)

 

Important: Salesforce cannot stop the Governors Limit or raise it. Following the best practices above should ensure that you don't hit this limit in the future.

 

Do go through the attached troubleshooting pdf for detail information on troubleshooting Too Many SOQL 101

 

Hope this helps someone out there......