Skip to main content

Creating Lookup or Master-Detail relationship


Creating Look up or Master-Detail


The steps to create a Look up or Master-Detail relationship are the same except that you need to choose the appropriate Field Type.

The below are the steps to create Look up Relationship  : 


   In case of Standard object : 






*** Go to Setup - Customize - Expand the options for the appropriate object on which you want to create a Look up Relationship - click on Fields

In case of Custom object : 


Setup - Create - Objects - <select the object> - New in the fields section.


*** Choose Lookup Relationship and hit Next
*** Select the other object to which this object has to be related and click Next


*** Fill in the required details :

You may have seen the options here that say  'What to do if the lookup record is deleted?' . Here if you choose 
- 'Clear the value of this field. You can't choose this option if you make this field required.' When the associated, parent object is delted, the value in the lookup field goes blank. But this option cannot be used with 'Always require a value in this field in order to save a record' enabled.  

- 'Don't allow deletion of the lookup record that's part of a lookup relationship.' Choosing this option, you would not be allowed to delete a Parent record when ever there is an associated Child record.

*** Proceed clicking on Next until you see the page where you can hit the Save button. 
[You may choose the profiles to which you would want to grant access, also can you choose which are the layouts on which you would want this field to be a part of .



The below are the steps to create Master Detail relationship : 


On Standard Object :
*** Go to Setup - Customize - Expand the options for the appropriate object on which you want to create a Master Detail Relationship - click on Fields

On Custom Object  : 

Setup - Create - Objects - <select the object> - New in the fields section.- Choose Master Detail relationship in the Field Type




Choose the object to which the current object should be made a child of.
Fill in the necessary details like Name , Description,etc.


Then click Next  , Next and Save


Sharing Settings :

In the process of creating the Master-Detail field, you would have come across Sharing Setting section which, just like in the pic above,

If 'Read Only: Allows users with at least Read access to the Master record to create, edit, or delete related Detail records.' is selected, there has to be a minimum Read permission to the Master record to be able to create, edit or delete records in the Detail objects

If 'Read/Write: Allows users with at least Read/Write access to the Master record to create, edit, or delete related Detail records.' is chosen, then to be able to create , edit or delete records in the Detail object.






Comments

Popular posts from this blog

How to create a validation rule in Salesforce

Validation rule is a filter or a criteria that validates the data that is pushed into an application and verifies if the data that has been entered is in accordance to the set standards. Example : Let's say, there is a field that is used to enter the Age of a Student. But per the organization rule, no student should be allowed to join the course if the age is not more than 25 years. So here you may write a validation rule saying that the Age field should not be more than 25. In case the age entered is more than 25, then the record is not allowed to be saved. You would see an error when you enter the age more than 25. Let me give you another example.  Say that there's a field to enter the Product code. And per the rule of the organization, the Product code should always start with PR. In case you enter any code other than the one that begins with PR, you would encounter an error. The benefits of Validation rules is that you can improve the quality of the data that is go...