You need to sign in to do that
Don't have an account?
Sammy7
invalid foreign key relationship: access field on custom object with master detail to opportunity
So I have custom object (invoice__c) with master-detail to opportunity. I have a custom field (AF_LastSyncTime__c ) on invoice__c that Im trying to access.
so here is my query:
No error with query, but I get invalid foreign key relationship in the if statement....why is that?
Thanks.
so here is my query:
for (Opportunity opp : [select Id, (select id, AF_LastSyncTime__c from Invoices__r), (select Id, Invoice_No__c, QuotetoInvoice__c, CreatedDate from Quotes order by CreatedDate DESC) from Opportunity where Id IN :oppsId]) { if (opp.Invoices__r.AF_LastSyncTime__c==null) return 'blah blah blah'; }
No error with query, but I get invalid foreign key relationship in the if statement....why is that?
Thanks.
From your query it seems that invoice is child of opportunity to access invoice records your syntax would be Hope this helps.
Please note that i haven't verified the code for syntax errors.
All Answers
From your query it seems that invoice is child of opportunity to access invoice records your syntax would be Hope this helps.
Please note that i haven't verified the code for syntax errors.