Pages

Monday, July 13, 2015

Salesforce: Report Type for Master-Detail versus Lookup Relationship

First things first, to allow an object in Salesforce available for report, system admin must check "Enable Reports", go to the object detail to enable it:


If the object is related to another objects, Salesforce will automatically create report type based on the object relationship and setting for enable report.



Master-Detail Relationship
In Master-Detail Relationship, each child always need to have a parent, while parent maybe do not have child.

If both object is enable for report, there is one report type created by default, which is Parents with Children, but no child only report type.
Using Customers with Claims (see screenshot above) report type, it will produce all Customers with Claims only, Customers without Claims will be not show in the report.

You can create custom report type for Children only.


Lookup Relationship
In Lookup Relationship, a child may not related to parent.

If both object is enable for report, Parent report type, Children report type will be created by default, and Children with Parent report type.
Using Areas with Region (see screenshot above) report type, it will produce all Areas with Region only, Areas without Region will be not show in the report generated.

You can create custom report type for Regions with Areas, remember that custom report type always start from parent down to children, but you can add fields of parent in child object using fields related via lookup when edit custom report type.


Notice that by default in the MD relationship, it is "Parents with Children", while in Lookup relationship, it is "Children with Parent".