function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Girish ParwaniGirish Parwani 

How to display custom object field from related object on report on parent object?

I have two objects A and B related through lookup. Object A has a lookup relationship field to object B. I need to display a custom field from object B in a report which is based on object A. Is it a good idea to create a formula field in object A and use that field in report. Is there any better alternative available ? Will it be slower (or not a good practice) to do it using a formula field and not creating a custom report type ? Is there a way to find out if a report is build using default / standard report type ?
NagendraNagendra (Salesforce Developers) 
Hi Girish,

Salesforce provides relationship fields (like lookup or master-detail) based on which we can setup relationship among objects.

We can easily filter set of records based on query or filter condition.

Is it a good idea to create a formula field in object A and use that field in the report. Is there any better alternative available? Will it be slower (or not a good practice) to do it using a formula field and not creating a custom report type?

It depends on the purpose of your requirement. Moreover, using formula field in query condition slower the retrieval process because formula field is not indexed.

We can traverse up to 5 related objects based on the relationship.

A formula field is good if you try to display parent's information on the child object or try to achieve some calculation or you want to put information combining different field values.

Now, if you try to display child's information at Parent then formula field will not work.

So, if we achieve results from our relationship fields then it is not advisable to create duplicate formula fields just to show the related record information.

Is there a way to find out if a report is build using default / standard report type?

Yes, out-of-box, Salesforce provides following report type when we try to create a report. 
User-added imageNow, according to your requirement, if you have custom objects, then Salesforce cannot provide standard report type for your relationship. That's why you need to create custom report type and define how you could create reports based on that.

For more information, refer Set Up a Custom Report Type(https://help.salesforce.com/articleView?id=reports_report_type_setup.htm&type=0)

Thanks,
Nagendra.