I am trying to retrieve the following fields Owner.Name, Name, Id from ActionPlanTemplate object and returning a list. However, when the list is returned, I do not get Owner.Name in the ActionPlanTemplate object.
How can I get the Owner.Name in the ActionPlanTemplate list for each object?
When I enter the same query in Query Editor, I get the correct results.
String test = 'SELECT Owner.Name, Name, Id from ActionPlanTemplate';
List<ActionPlanTemplate> apt = database.query(test);
System.debug(apt);
This returns:
(ActionPlanTemplate:{OwnerId=0031W000019AA3qWBF, Name=APT Test, Id=0WS5E0000000044WAA}, ...
EDIT: After reading the recommended solutions, Yes Owner.Name can be called when I refer to it directly as object.Owner.Name, however I am trying to display this component as a value in my lightning data table column.
component.set('v.APcolumns', [
{label: 'Action Plan Template Name', fieldName: 'linkName', type: 'url', typeAttributes:{ label: { fieldName: 'Name'} }, target:'_blank', sortable: 'true'},
{label: 'Template Owner', fieldName: 'Owner.Name', type: 'text'}
]);
The Action Plan Template name shows up, but not the Owner.Name
System.debug()
is deceiving you. See the answers on the linked question for more details.