Salesforce Fact #864 | Using null coalescing and safe navigation together in Apex

Suppose we have a Map<String, List<Id>> and based on some condition checks, we need to add or update the list as part of the map value with respect to key value.

We can do the check a bit differently using both safe navigation and null coalescing operator.

In this example, we are storing the list of Ids in map specific to object key prefix.

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