Salesforce Fact #498 | Reusing map in apex code

Most of the times in our apex code, we use set collection to store recordIds and then we get the record details and store it in a map.

In some of the scenarios, we can make it work using the same map only, no need to use any set. For example, in the Contact trigger we are getting the related AccountIds and getting the account record details later on. We can use a single map to get this done.

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