How can I get the field results from a dynamic database query to be available to be put into a list? Here is the code I have:
//Query on the destinationObjectFieldName results
List<sObject> desinationObjectList =
Database.query('SELECT Id, Name FROM ' + destinationObject + 'WHERE Id IN :relJunctionObjects' );
System.debug('desinationObjectList List contains: ' + desinationObjectList);
//Add the results into the RelatedObject list
for(sObject s: desinationObjectList) {
pickListValuesList.add(new RelatedObject(s.Id,s.Name));
}
Yet I get the error
Variable does not exist: Name