Salesforce Fact #223 | Modifying collection during iteration itself

Do you know we can make changes in the collection which is used in the SOQL filter during the iteration itself.

Suppose, we have a set of account names and we would like to find out the unique ones from the set. In this case, we can iterate over the SOQL result and at the same time remove the name which is returned in the current iteration. This is quite efficient as the need for using an extra collection to store the unique values is removed.

Attached are the screenshots.





Comments

Popular posts from this blog

Salesforce Fact #192 | Call batch apex from flow

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