Lightning-Flow-Scanner / lightning-flow-scanner-core

A rule engine capable of conducting static analysis on the metadata associated with Salesforce Lightning Flows, Process Builders, and Workflows.
https://www.npmjs.com/package/lightning-flow-scanner-core
MIT License
27 stars 9 forks source link

Queries Inside Loops #25

Closed richcallear closed 1 year ago

richcallear commented 1 year ago

Hi - really useful tool - one key rule that I think is missing (or I missed it) is checking for flows that run queries within loops - better practice is to run a large query outside the loop and then use the "filter records" where necessary. Risk of queries within loops is that you'll run into the "too many SOQL queries" governer limit.

RubenHalman commented 1 year ago

Hi Richard. Thanks for your kind words. SOQL queries are actually a form of DML statements, so they will be flagged with the rule 'DML statements in a loop'. I think this can maybe be made clearer in the documentation, but if you use the vscode plugin it might also help explain.

richcallear commented 1 year ago

Ah, nice - I should've looked more into the code base before commenting 👍

RubenHalman commented 1 year ago

no thank you for helping me see the technical description is probably too technical haha, it's good that you ask questions. please continue to keep interacting with us on your experience!