0

I have two objects Object A Object B

I created a custom report type to link Object A and Object B.There are two look up fields that connects Object B to Object A.

I want to ensure my report type is using the correct relationship to navigate from Object A to Object B. Is there a way I can find this?

Thanks AJ

1 Answer 1

1

Go to your report type (Setup --> Report Type) and look at the object relationships

enter image description here

  1. This will display the related list label. This is mentioned in the Add Child Objects to your Custom Report Type help doc.

NOTE The name of the primary object is derived from the plural label field. The names of any related objects are derived from either the related list label field or the custom field that defines its relationship to the primary object.

You can cross-reference it matches with your expected lookup by going to the custom field itself. If you don't have unique related list labels, you can quickly edit this and it'll reflect in the report type with a refresh (and then change it back).

enter image description here

  1. Assuming it's new, you can also see similar info by clicking into Edit Layout within Fields Available for Reports. If you look at the fields from your source object, you should see the lookup being used as the only field not already selected to display (highlighted in gold).

enter image description here

  1. As a non-UI option, you can also take a look at the ReportType metadata in VS Code.
sfdx force:source:retrieve -m ReportType

Instead of the related list label, it'll display the relationship name that you can cross-check with the lookup field.

<ReportType xmlns="http://soap.sforce.com/2006/04/metadata">
  <baseObject>test_plural__c</baseObject>
  <category>accounts</category>
  <deployed>true</deployed>
  <description>test</description>
  <join>
    <outerJoin>false</outerJoin>
    <relationship>Accounts__r</relationship> //here you can cross-reference
  </join>
  <label>testing kris</label>
....
4
  • Thanks for the quick response. Given I am not very sure how to look up the metadata, if I were to use your first approach: 1. The item highlighted in your screenshot is the name of the custom object. I need to understand which look up object links it to the primary. Does the related list label really have an impact. That is the just the name that will be displayed on the UI correct?
    – user102545
    Commented Aug 10, 2021 at 20:29
  • I assumed you just wanted a way to figure out which lookup the report type is using if you have multiple. The related list label is not controlling anything in your report, it's just what it displays in the report type UI and something you can use to figure out which relationship field it's actually using. If you want to change what lookup field it's using, edit the report type. Commented Aug 10, 2021 at 20:40
  • I apologize for not being clear. Perhaps this will help. Object A - Accounts. Object B - Schedule. I have two look up fields on Schedule , Field-Morning and Field - Night that links into account. I want to make sure that the report is using the "Morning" look up field to run the report. Are you saying, I need to go to the field "morning" and take a look at the related list label?
    – user102545
    Commented Aug 10, 2021 at 20:46
  • Correct. That'll help you confirm with what the report type UI shows you so you know which lookup field it's using in the report type. Otherwise, you can take a look at the metadata and do the same thing but look at the relationship field of the lookup. I had edited my example to be obvious, but if your related list label is the same across lookup - you can quickly edit it to confirm which one it is. Commented Aug 10, 2021 at 21:12

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .