You need to sign in to do that
Don't have an account?
Ankit Khiwansara 10
Unable to Use Child to Parent Relationship Query
Hello ,
I have created two lookup relationship on Contact object with Account Object.
But i am unable to use SOQL query with one of the relationship. Can you please help me on this.
Could you please help me to understand, as both the relationship from contact to account are same, why SOQL is working with other relationship and not with other one
I have created two lookup relationship on Contact object with Account Object.
But i am unable to use SOQL query with one of the relationship. Can you please help me on this.
Could you please help me to understand, as both the relationship from contact to account are same, why SOQL is working with other relationship and not with other one
The second query should be like below,
SELECT FirstName, LastName, Parent_Account__r.Name, Parent_Account__r.Industry FROM Contact
This is becsue, API name of the field is 'Parent_Account__c' and not CustomContacts__r
Thanks,
Govindaraj.S
All Answers
The second query should be like below,
SELECT FirstName, LastName, Parent_Account__r.Name, Parent_Account__r.Industry FROM Contact
This is becsue, API name of the field is 'Parent_Account__c' and not CustomContacts__r
Thanks,
Govindaraj.S
Thanks Govind it worked.
Could you please confirm dont we have to use relationship name in SOQL query ?
We will, when need to query child from parent.
SELECT Name, (SELECT Email FROM CustomContacts__r) FROM Account .....Something like this.
Please let us know, if this helps.
Thanks,
Govindaraj.S
Please confirm whether my understanding is correct
https://webkul.com/blog/relationship-query-salesforce/