Skip to main content
I get the below error when trying to query from a custom object "Third Party Products& charges" and Account object. This is how my query looks as of now I need the columns Account ID, Name, PC USers, TM Users, CMR from Account and Certified Independent Consultant from Third PArty Product & Charges custom object.

SELECT Id, Name, Account.Third_Party_Product_Charges__c__r.Certified_Independent_Consultant__c, PC_Users__c, TM_Users__c,  Previous_CMR__c

FROM Account

WHERE Account.Opportunity_Stage__c = 'Closed Won' AND Account.Third_Party_Product_Charges__c__r.Certified_Independent_Consultant__c != '' AND Account.Third_Party_Product_Charges__c__r.CIC_Contract_Date__c > 2022-12-01

ERROR :

Didn't understand relationship "Third_Party_Product_Charges__c__r" in field path. If you are attempting to use a custom relationship, be sure to append the '__r' after the custom relationship name.

Appreciate any help on this.

TIA
5 réponses
  1. 28 déc. 2022, 06:33
    Resolved the error. Since the custom object has a lookup relationship to Accounts, I had to Select from that rather than Account.

    Ex:

    SELECT Id, Name, Account__r.Name, Account__r.Previous_CMR__c, Account__r.PC_Users__c, Certified_Independent_Consultant__c FROM Third_Party_Product_Charges__c WHERE Account__r.Opportunity_Stage__c = 'Closed Won' AND Certified_Independent_Consultant__c != '' AND CIC_Contract_Date__c > 2022-12-01
0/9000