Salesforce Fact #86 | Check first, then make the SOQL query

Unlike DML, if we fetch data using SOQL against an empty list or set in filter condition, it is still counted towards as 1 SOQL in governor limit. And also the resultant list is empty.

Therefore, before making the query we can check whether the list or set is empty or not and then query accordingly. This would save 1 SOQL query count in governor limit.

Attached is the screenshot.





Comments

Popular posts from this blog

Salesforce Fact #192 | Call batch apex from flow

Salesforce Fact #457 | Get current user role name in flow