Ask Search:
Laura MarshallLaura Marshall 

Tutorials on Creating Parent Child Relationships with Custom Objects?

I am trying to create a query between two custom objects and I am getting this error below.  I am wondering if there are any good tutorials on how to create parent child relationships between custom objects that show step by step of how to set up a relationship such that the query is allowed: 

SELECT Id, Name, Parent__r.Id, Parent__r.Name from Child__c ORDER BY Parent__r.Name

I see the mother child page on this api doc but I am unable to find this feature in my Developer account. If someone can point me to how I can do this, I would appreciate it.

http://www.salesforce.com/us/developer/docs/api/Content/sforce_api_calls_soql_relationships.htm#fk_and_null_topic-title

SOQL Error:

Parent relationship queries are not allowed



Mandar KulkarniMandar Kulkarni
Hi, 

I am not sure what exactly you need in query.
If you want to learn about writing queries, then yes i agree, salesforce documentations are not that great :P .

I can help you with the query you want to write. Let me know exactly what you want to achieve and the relationships and field names of your custom objects. So that I can help you to write a query.

You can drop an email to me at mandy.kool@yahoo.com or you can connect with me on my skype id - mandar19.kulkarni
Laura MarshallLaura Marshall

Thanks, I have figured out the relationship query for my object by using the correct relationship name and the letter to reference the object field.

 

My query now works as expected:

 

Select c.Name,c.Course_title__c, (Select Id, Name From STUDENT_COURSES_DETAILS__r) From Course__c c

I found this page useful:

http://sfdc.arrowpointe.com/2007/01/19/set-child-relationship-name-on-custom-relationship-fields/