function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
sahiti@sfdcsahiti@sfdc 

How to determine which is parent object and which is child object in lookup relationship?

Please explain with an example.
Best Answer chosen by sahiti@sfdc
NagendraNagendra (Salesforce Developers) 

Hi Sahiti,

Hope you are doing good.

Parent object and child object in the lookup relationship are determined purely on the requirement.

Example: The object which has the more number of records will be the parent object and the object which has fewer records is considered as the child object. The reason is parent object has the data and the child object will have the lookup field which will refer those data. Hence whichever object you create a lookup field will be the child object and the data which it refers to is considered as the parent object.

Hope this helps.

Kindly mark this as solved if the reply was helpful.

Thanks,
Nagendra
 

All Answers

NagendraNagendra (Salesforce Developers) 

Hi Sahiti,

Hope you are doing good.

Parent object and child object in the lookup relationship are determined purely on the requirement.

Example: The object which has the more number of records will be the parent object and the object which has fewer records is considered as the child object. The reason is parent object has the data and the child object will have the lookup field which will refer those data. Hence whichever object you create a lookup field will be the child object and the data which it refers to is considered as the parent object.

Hope this helps.

Kindly mark this as solved if the reply was helpful.

Thanks,
Nagendra
 
This was selected as the best answer
Ajay K DubediAjay K Dubedi
Hi sahiti,
+ Nagendra,
Lookup relationship of parent and child object depends upon the business scenarios. In a lookup relationship between the parent object and child object are loosely coupled i.e. they are independent to each other. Forex: There is a Project(parent) object which has a lookup of Employee(child). If the project is completed then the employee will be still present to work on other projects. Most commonly the parent has less number of records as compared to child records.

Please go through these links for better understanding:
https://trailhead.salesforce.com/en/modules/data_modeling/units/object_relationships

https://developer.salesforce.com/docs/atlas.en-us.soql_sosl.meta/soql_sosl/sforce_api_calls_soql_relationships_and_custom_objects.htm

Thank you,
Ajay Dubedi