When you do a SOSL query - the result is in the form of multiple lists (one for each object you search).
List<List<sObject>> resultsList =
[FIND 'test' IN NAME FIELDS RETURNING Object__c(Id,Name) limit 10];
The line above does the SOSL query and now we have results in the "resultsList
" list.
My problem is now getting those results into a simple "List<Object__c>
" list.
When I try to assign the results like this, the list is always empty/null:
simpleList = ((List<Object__c>)resultsList[0]);
I've also tried assigning in array format, but always blank still, also tried using a for loop to iterate through the "resultsList
" and add to my simpleList, but no dice.
So even though the SOSL query is definitely returning results, the list is always empty.
Anyone have any ideas? Thank you!
resultsList
isn't just containing a list of empty lists.