No, we cannot create directly. To create first we should create Look up relationship then populate the field value for all the records and then convert the look up relationship to master detail relationship.
If the parent object doesn’t have Roll up Summary fields for the child object then we can convert.
If the parent objects don’t have Roll up Summary fields for the child object then we can delete. To delete a child object it should not be referred in Apex Classes and Apex Triggers. Later if we undelete the object, Master detail fields on the junction objects will be converted to look up Fields.
Note: If we delete only Master – Detail Relationship field from the child object and undelete it from the Recycle Bin then it will be converted to look up relationship. Parent Object we cannot delete because it will be referred in the child object.
Master – Detail Relationship data types will be converted to look up relationship data types.
If we delete parent object record all the child object records relationship’s field value will be get deleted. (Entire record won’t be get deleted) Example:
Child Object: Employee (Employee object have Department field which is related to Department Object)
Parent Object: Department
Suppose N number of employee records related to IT department, if we delete IT department all the child (Employee) records Department field value related to IT department will be get deleted.
Note: Salesforce store deleted records only for 15 day in Recycle bin later it will remove the records permanently. If we undelete the IT department record from the Recycle bin then all the related child records department field value will be restored.
If we delete the parent object record all the child object records will be get deleted. Example:
Child Object: Employee (Employee object have Department field which is related to Department Object)
Master Object: Department
Suppose N number of employee records related to IT department, if we delete IT department all the child records will get deleted.
Note: Salesforce store deleted records only for 15 day in Recycle bin later it will remove the records permanently.
If we undelete the IT department record from the Recycle bin then along with IT department record all the related child (Employee) records will be restored. (We cannot see the child object records in the Recycle bin)
A child object which is having master detail relationships with two different parent object is called junction object.
Example: Object1: Department
Object2: Project
Child Object: Employee
Field1: Department (Master Detail with Department )
Field2: Project(Master Detail with Project)
Note: From the above example we can say Employee Object as Junction Object.
Child records will be get deleted which are related to Department as well as Project.
Note: If we undelete the IT department record from the Recycle bin then along with IT department record all the related child (Employee) records will be restored those will be reflected for Project as well. (We cannot see the child object records in the Recycle bin)