I am getting an error saying Save error:Invalid foreign key relationship: Opportunity.quotes
List<Opportunity> oppsFromDb = [SELECT
id, stageName, name, accountid, owner__c,
end_user_contact__c, recordTypeId, ownerId,
(SELECT id FROM Service_Contracts__r),
(SELECT id, Agreement_Term__c, Transcoding_Overage__c, Media_Storage_Overage__c,Data_Transfer_Overage__c,
Equipment_Totals__c, Set_Up_Fee_Totals__c, Monthly_Recurring_Totals__c, Commencement_Date__c,
Media_Object_Overage__c, Media_Request_Storage_Overage__c, Entitled_Media_Storage__c,
Entitled_Data_Transfer__c, Entitled_Transcoding__c, Entitled_Media_Object__c, Entitled_Media_Reqest__c From quotes)
FROM
Opportunity
WHERE
id IN:oppIds
];
The call is to the quote is :
for(Opportunity goodOpps: oppsFromDb){
SContract.add(new ServiceContract(Quote__c = goodOpps.quotes.id, etc...));}
Do i need to create seperate lists for the quote and the Service Contract? Making it 3 seperate SOQL queries and then having to run separate queries to the lists when I need to get information specific to the parent opportunity?
Thanks
List
. It will allow you to enter line breaks and continue your logic on the next line while considering it all a single statement.