Salesforce Fact #194 | Safe navigation in if-else condition

Do you know we can use safe navigation operator in if-else check. Suppose, we have to check whether a list is not NULL and also it is non-empty. So generally we would first check if it is NULL and then would check with the isEmpty() function.

But using safe navigation operator, we can cover both the condition check in a single expression. The results would remain the same in both the cases.

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