I have created an Apex class with an SOQL query to get OpportunityLineItems. Testing the SOQL in query editor returns the expected response. All of the fields render in the LWC data table except for Product2.Name.
@AuraEnabled(Cacheable = true)
public static List<OpportunityLineItem> getOpportunityLineItem(){
return [SELECT Id, Product2Id, Product2.Name, Quantity, UnitPrice, ProductCode FROM OpportunityLineItem];
}
Columns from LWC
const columns = [
{
label: 'Product Name',
fieldName: 'product2.Name',
type: 'text',
cellAttributes: { alignment: 'left' }
}, {
label: 'Quantity',
fieldName: 'Quantity',
type: 'number',
editable: true,
cellAttributes: { alignment: 'left' }
}, {
label: 'Sales Price',
fieldName: 'UnitPrice',
type: 'currency',
editable: true,
cellAttributes: { alignment: 'left' }
}, {
label: 'Product Code',
fieldName: 'ProductCode',
type: 'text',
cellAttributes: { alignment: 'left' }
}
];
fieldName: 'Product2.Name',