Custom Report Types are a fantastically easy way to create complex, dynamic reports that go beyond standard Salesforce reports.. A report type can be looked at as a template or framework that tells Salesforce which objects/relationships to look at and which fields to grab. By default, you get given various standard reports that Salesforce generates automatically for you. These reports link standard objects together like Accounts with Opportunities, Opportunities with Products, as well as reporting on Objects on their own, e.g. “Cases”. If you also create custom objects and add lookup/master-detail relationships, Salesforce will automatically create standard report types for these as well, such as Opportunities with Shipping or Opportunities and Shipping (Depending on whether it is a lookup or master-detail).
To create reports outside of these standard reports we need to create custom report types. Custom report types can include up to 4 objects in a parent-child mode, include fields from lookups to other object as well as a whole bunch of other features, let’s take a deeper look. To get started on CRT please navigate to..
CRT are needed when you have a requirement to report on more objects than standard reports allow. You can add up to 4 layers of objects as long as they have a parent-child relationship. Below you can see a diagram of a basic CRT created using various custom objects. These objects are all related with lookups and each successive object needs to be a child or grandchild of the master object.
You will notice that the image above of a CRT has a venn diagram associated to it. This is so you can visually see what record your report is going to bring back. In this instance, you can see on the left hand side that each related record must have at least 1 related record from each object. This means that records will only come back if they each have one of these objects associated to them. However, what happens if you do not need each record to have a related record? You have the option at each level to select whether the related object should or should not have related records or not. As you can see from the adjusted image and venn diagram below, we have selected that each record may or may not have related records. This means that every single Contact in the system will come back with or without their related records.
Fields Via Lookup
With standard reports, fields are automatically added from some related objects depending on which report is used. Fields are also automatically added when new ones are created on the object. However, with CRT you can add fields into the report from ANY related object. This is especially useful when you need to view fields that may not be needed on the object itself, but are key to reporting. If we use the example above and look at “CustomObject3”, this particular object has a lookup field to the Opportunity object. By using the “Add fields related via lookup” feature, we can add in some Opportunity fields too. To do this yourself you need to go to your CRT under Setup, navigate to Edit Layout at the bottom of the page and click Add fields related via lookup on the right hand side of the page while also selecting the object from the drop down list. Once you have selected your various fields, they will display on your layout page with a magnifying glass icon like the below.
From Winter ’21, you can auto add fields to Custom Report Types, without having to manually update each CRT with new fields that you create.
Create, Remove, Rename & Reorder Sections & Fields
Adding fields via lookup brings me very nicely onto my next section. From the Edit Layout page you can control exactly how the fields and sections display when a user is creating a report. As you can see from the above image of my CustomObject3 lookup fields there is an Edit and Delete button, with the Edit button letting you rename this section. New sections can also be added by clicking Create New Section at the top of the page. From the below image you can see I’ve created a section called “Key Statistic Fields”, these sections can also be dragged around to control their display order.
As well as moving sections around to better suit your users you can remove, reorder and delete fields as you please. These can simply be dragged and dropped
Again in the Edit Layout view, you can control which Columns display on the report as default when you create a new one. This is especially useful if each report you create is going to need some foundation fields. To add default columns to any report, simply double click on any field. This gives you two options, you can change the label of the field and check it as default, this will add it to every report that is created.