I am making a lightning component for a user to create a quote + line items quick and easy. However the apex function that is meant to query the pricebook entry and its Id for each line item is causing an internal salesforce error.
I am unsure as to why, because another function has pretty much the same query and works fine.
Here is the function currently breaking:
@AuraEnabled
public static String createQuoteAndLineItems(Quote newQuote, List<QuoteLineItem> newQuoteItems)
{
try
{
//insert newQuote;
for(QuoteLineItem currentItem : newQuoteItems)
{
currentItem.QuoteId = newQuote.Id;
system.debug(currentItem);
system.debug(currentItem.UnitPrice);
system.debug(currentItem.Collection_Frequency__c);
system.debug(currentItem.QuoteId);
system.debug(currentItem.Product2Id);
}
//insert newQuoteItems;
return 'Success';
}
catch(exception e)
{
system.debug(e.getMessage() + ' ' + e.getStackTraceString());
return e.getMessage() + '\n' + e.getStackTraceString();
}
}
Internal error caused when trying to debug or query using Product2Id.
Update: Turns out I needed to do "Product2Id.Id" instead of just "Product2Id"... lol