Can you hold a list of Id's as a SObject list data type?

List SDR_IDs = new List(new Map([SELECT Id FROM user WHERE UserRoleId = '00E6A000000UW7gUAG' and IsActive = true]).keySet());

Let me know. I guess more generally, what I am asking is what values can the SObject class hold? Is it only default and custom apex objects or can it also hold integers, booleans, IDs, etc.

1 Answer 1


sObject can only hold records, such as Account or CustomObject__c. To hold any type, you can use Object, which is the parent object for all types.

  • You're the real god - Thank you Oct 9, 2019 at 13:26

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .