Salesforce Fact #953 | Limit error in Get Records while using IN operator
We need to be careful while using the IN operator in Get Records element in record-triggered flow.
If the text collection is empty, it seems Salesforce runs a query to fetch all the records of that sobject and the number of query rows are counted in the governor limit. So, if the total number of records for that sobject is more than 50000, it throws limit error.
Fix would be to always check if the collection is empty or not, before using it in the IN operation.
In this example, varIds is an empty text collection used in IN operation to fetch the account records. However, the number of query rows returned is 136 instead of 0, which is the total number of account records in the org.
Attached are the screenshots.


Very useful insight! Hitting the limit error in Salesforce Get Records when using the IN operator can be challenging for developers. Optimizing queries, managing collections efficiently, and breaking large datasets into smaller batches can help avoid such errors. Also, for businesses planning to migrate data from Salesforce to Zoho CRM, understanding these data handling limits is crucial for a smooth and error-free migration. Thanks for sharing this valuable tip!
ReplyDelete