You need to sign in to do that
Don't have an account?
RICARDO PALMA
Error: Compile Error: Didn't understand relationship
Hello all,
I have a custom relation master/detail (Qoutes__r) between Quote and QuoteLineItem.
I have a class where i need to get some data from Quote and QuoteLineItem but I'm getting this error:
Error: Compile Error: Didn't understand relationship 'Quotes__r' in FROM part of query call. If you are attempting to use a custom relationship, be sure to append the '__r' after the custom relationship name. Please reference your WSDL or the describe call for the appropriate names. at line 35 column 16
Here my code:
LstQuotes = [SELECT q.id,q.QuoteNumber, q.Ad_Name__c,q.Type__c, q.Size__c, q.Version__c, q.Bleed_Code__c,
(Select Quotes__r.Advertiser_Account__c From Quotes__r)
From Quote q
where City_Code__c = :theId and q.Media_Name__c =: strMediaID];
The error is on this line (Select Quotes__r.Advertiser_Account__c From Quotes__r)
Thanks.
I have a custom relation master/detail (Qoutes__r) between Quote and QuoteLineItem.
I have a class where i need to get some data from Quote and QuoteLineItem but I'm getting this error:
Error: Compile Error: Didn't understand relationship 'Quotes__r' in FROM part of query call. If you are attempting to use a custom relationship, be sure to append the '__r' after the custom relationship name. Please reference your WSDL or the describe call for the appropriate names. at line 35 column 16
Here my code:
LstQuotes = [SELECT q.id,q.QuoteNumber, q.Ad_Name__c,q.Type__c, q.Size__c, q.Version__c, q.Bleed_Code__c,
(Select Quotes__r.Advertiser_Account__c From Quotes__r)
From Quote q
where City_Code__c = :theId and q.Media_Name__c =: strMediaID];
The error is on this line (Select Quotes__r.Advertiser_Account__c From Quotes__r)
Thanks.
If it doesn't work check the referenced quote field name. As the error says you are using worng relationship name.
All Answers
If it doesn't work check the referenced quote field name. As the error says you are using worng relationship name.
Use below code IF it helps you than please mark it as a solution and ENJOY APEX
Another situation is when your Advertiser_Account__c is on child object and you are accessing it from Parent object quoe then you should use the below one :-
If this helps,please mark it as best answer to help others :)
I am glad to help. You may not receive any data if filters you applied in "WHERE" doesn't satisfy any criteria. Look for City_Code__c and Media_Name__c matched the value passed in variables "theId: and "strMediaId"
The initial issue was wrong relationship name.
I'm not getting an error any more, but I'm not getting any data from QuoteLineItem. I'm sure if the relation is working.
Thanks.
check this link for help.....
https://developer.salesforce.com/docs/atlas.en-us.soql_sosl.meta/soql_sosl/sforce_api_calls_soql_relationships_understanding.htm