Sunday, April 5, 2020

How can we efficiently generate a List of Id from a List of SObject structure with just one line of code?


Do you know how to get a list<Id> from a list<SObject>? Yes, doing a loop of the list of SObject and then put each record Id into another list or set. 

What if this was possible in just one line of code?

Infact, it is possible to write this in just one line of code. Don't believe me? Take a look below. 

Let say we have a list of contact records from which we only want to extract the list of record Ids.

Cheers

No comments:

Post a Comment