Since I started coding in Apex, I've gotten used to working with lists of IDs of objects not the objects themselves.
This time around, instead of creating a List<ID>
of account ids, I created a List<Account>
.
Now, I'm trying to add account records to this list, via a lookup field on a related custom object. However, when I do this, I get an error back telling me I'm trying to add an ID to an sObject list.
So what I'm wondering is, how would I best indicate that it's the sObject record as a whole I want to add, not just the ID indicated by the lookup field? And if it involves a SOQL query, wouldn't that be problematic in terms of hitting governors limits?