Page Layouts and Record Types in Salesforce

Page Layouts and Record Types

Page Layout

The organization of fields, custom links, and related lists on an object detail or edit page.

Used to organize UI pages for your users:

–          Which fields, related lists, and Custom links a user’s sees.

–          Field properties – visible, read-only and required.

–          Page section customizations.

NOTE: Establish unique layouts for different business scenarios.

Creating Page Layout:

Following is example to create page layout for case object.

Set Up->Customize->Case->Page Layout->Click on New button

Fill Mandatory details

Drag and drop required to the layout and save page layout.



Record Types

Record types allow you to associate different business processes and subset of pick list value to different users based on their user profile.

They are used to drive which page layouts users see when viewing records, based on their user profile.

Benefits of record types:

 Tailors user interaction experience to specific business needs.

Allows for easier administration as there are fewer fields to maintain.

Creating Record Types:

Example to create record types: In this example I am creating record type for Case object.

Setup->Customize->Case->Record Type

Creating Record Type1

Click on New button and fill all mandatory fields and select profiles.

Create a support process before creating record type

Creating Pagelayout 2

Click on NEXT button

Creating Record type3

Select page layout and click SAVE.


Page Layout Assignment

Go to Record Type or Page Layout and click on Page layout Assignment

assign page layout to record types based on profiles.


Page Layout Assignment


Interview Questions on Page Layouts and Record Types in Salesforce

What is Page Layout and Record Types?

Page Layout:
– How detail and edit pages are organized
– Page section customizations
– Which fields, related lists, and Custom Links a users sees
– Field properties – visible, read-only and required
Record Types:
Allows you to define different sets of picklist values for both standard and custom picklists
– Record Types help you implement your custom business processes
What are the different ways of making a field mandatory?
3 ways of making the field mandatory are:-
Page Layout:- Field can be made mandatory from the page layout when it needs to be made mandatory for a set of users
Field Level Security:- Field can be made mandatory from the FLS when it needs to be made mandatory for all the users in the Organization and even from the API’sValidation Rule:- Field can be made mandatory from the Validation Rule when it needs to be made mandatory for user who is using the same Page layout used by other recommends using the Page Layout option for making the field mandatory.
How can we make a field mandatory from page layout?
Go to page layoutedit that layout and thenclick on properties of the field that you going to make it mandatory

Check the required check box.

Making Field Required


 When are the Record types used?

 Record Types are used in the following two cases

To assign the different Page layouts to different users based on their profiles.
To enable different sets of Standard/Custom Picklist values for two different users using the same page layout.


Object Relationships in Salesforce

Object Relationships in Salesforce

A relationship is a bi-directional association between two objects. Relationships allows us to create links between one object and another. The platform supports following relationship types

  • Master-Detail
  • Lookup
  • Many-to-Many

Master-Detail (1:n)

A parent-child relationship in which the master object controls certain behaviors of the detail object.

  • When a record of the master object is deleted, its related detail records are also deleted.
  • The Owner field on the detail object is not available and is automatically set to the owner of its associated master record. Custom objects on the detail side of a master-detail relationship cannot have sharing rules, manual sharing, or queues, as these require the Owner field.
  • The detail record inherits the sharing and security settings of its master record.
  • The master-detail relationship field is required on the page layout of the detail record.
  • By default, records can’t be reparented in master-detail relationships. Administrators can, however, allow child records in master-detail relationships on custom objects to be reparented to different parent records by selecting the Allow reparenting option in the master-detail relationship definition.

You can define master-detail relationships between custom objects or between a custom object and a standard object. However, the standard object cannot be on the detail side of a relationship with a custom object. In addition, you cannot create a master-detail relationship in which the User or Lead objects are the master.

Lookup Relationship (1:n)

This type of relationship links two objects together, but has no effect on deletion or security. Unlike master-detail fields, lookup fields are not automatically required. When you define a lookup relationship, data from one object can appear as a custom related list on page layouts for the other object. See the Salesforce online help for details.

  1. Child row not automatically deleted when a parent row is deleted
  2. No inherited sharing.
  3. 25 lookup relation relationships allowed per object.
  4. Lookup field on child not necessarily required. 


You can use master-detail relationships to model many-to-many relationships between any two objects. A many-to-many relationship allows each record of one object to be linked to multiple records from another object and vice versa.

To create a many-to-many relationship, simply create a custom junction object with two master-detail relationship fields, each linking to the objects you want to relate.


Interview Questions about object relationships in Salesforce:

 How many relationships included in SFDC & What are they? 

We are having three types of relationships, they are

Lookup Relationship

Master-Detail Relationship

Many-to-Many relationship 

 What is a “Lookup Relationship”?

Up to 25 allowed for object

Parent is not a required field.

No impact on a security and access.

No impact on deletion.

Can be multiple layers deep.

Lookup field is not required.

 What is “Master-Detail Relationship”?

Master Detail relationship is the Parent child relationship. In which Master represents Parent and detail represents Child. If Parent is deleted then Child also gets deleted. Rollup summary fields can only be created on Master records which will calculate the SUM, AVG, MIN of the Child records.

Up to 2 allowed to object.

Parent field on child is required.

Access to parent determines access to children.

Deleting parent automatically deletes child.

A child of one master detail relationship cannot be the parent of another.

Lookup field on page layout is required.

Does an object can have both relationships (Lookup Relationship & Master Detail Relationship) at a time?

Yes, single object can have both relationships at a time.

What is a “Self Relationship”?

A self Relationship is a lookup relationship to the same object.

Suppose let’s take an object “Merchandise”. Here we can create relationship in between the Merchandise to Merchandise (same object) object. That is called “Self Relationship”.

What is “Many to Many Relationships”?

Allow for the relationship of two objects in a many-to-many fashion.

How we achieve the “Many-to-Many Relationship”?

By using Junction Object we can achieve this relationship, here junction object is having Master- Detail Relationship with different objects (Ex.Students & Courses). Using this Master to Detail Relationship, we can create the Many-to-Many Relationship in between the objects.

 What are the main things need to consider in the “Master-Detail Relationship”?

Record level access is determined by the parent,

Mandatory on child for reference of parent, cascade delete (if you delete the parent, it can cascade delete the child).

What are the main things need to consider in “Lookup Relationship”?

Loosely coupled, not going to have all the above rules which are existed in master detail relationship.

Self relationship is always lookup to self relation object type. In many to many we actually create a junction object in the middle, it does lookup for the bound objects that are ultimately being bounded in a many to many way.

Can we convert the lookup relationship to Master Detail relationship?

Yes, We can convert the lookup relationship to master detail relationship only if all the existing record has valid lookup field values.

Can we create Master Detail relationship on existing records?

No. first we have to create the lookup relationship then populate the value on all existing record and then convert it.