Salesforce Asked on November 23, 2021
In Lightning Experience I have created a dashboard that displays a number of Account and Opportunity reports. These reports themselves do not apply any filtering on Territories, but the dashboard does. This works perfectly, just select the appropriate Territory in the dashboard filter and this filter is applied to all reports in the dashboard.
One problem: the dashboard is also supposed to show a Leads report. But Leads and Territories do not play well together. I found a trick to find out the appropriate Territory for a Lead (create a dummy Account with the address of the Lead, await Territory assignment and delete the Account), but this is only half the work: I still need to get the dashboard filter to use this information.
Has anybody ever attempted this and succeeded?
I don't believe you'll have any luck doing this. The limitations are two-fold:
Leads are not part of Territory Management as they don't have a master-detail relationship to accounts. See this idea. Your workaround (dummy account), which I assume you may have gotten from this help doc, helps utilize it for assignment, but doesn't change the fact that it's not related in a way that the Dashboard can use.
The dashboard filter functionality is not something you can change through the UI (see edit for how to change it below editing xml) and is controlled by what Salesforce deems as equivalent fields. This usually limits you from making easy connections between fields with the same data type across objects. See this idea which is asking for the ability to set up what fields are equivalent or at least match up custom fields with the same name and data type across objects. This would help you if you stamped the Territory Name on a custom field on Leads and could tell the dashboard to use it. As of right now, you can see what Salesforce deems as equivalent fields by putting all your reports on a dashboard first, and then attempting to create a filter. It'll only display fields that are available.
Edit: You actually can technically do this as the below gets around limitation #2 mentioned above
It requires you editing the Dashboard XML directly which allows you to set a field on the Lead report component to use for the defined filter at the dashboard level. The below assume you have a custom field on your Lead object that is filled with the Territory Name. Not saying this is a good idea, but it is a way to achieve this.
sfdx force:source:retrieve -m Dashboard
)dashboardFilterColumns
for the <dashboardComponent>
that houses the Lead report (you can check the others to see how it looks)<column>
to reference your custom Lead field that represents Territory NameExample XML of the dashboardGridComponent related to your Lead Report where you can inject the reference to the field that the filter should use.
<dashboardGridComponents>
<colSpan>4</colSpan>
<columnIndex>0</columnIndex>
<dashboardComponent>
<autoselectColumnsFromReport>false</autoselectColumnsFromReport>
<componentType>FlexTable</componentType>
<dashboardFilterColumns>
<column>Lead.Territory_Name__c</column>
</dashboardFilterColumns>
<flexComponentProperties>
....
</flexComponentProperties>
<groupingSortProperties/>
<header>New Leads Report</header>
<report>unfiled$public/New_Leads_Report_LDm</report>
</dashboardComponent>
<rowIndex>16</rowIndex>
<rowSpan>8</rowSpan>
</dashboardGridComponents>
Answered by Kris Goncalves on November 23, 2021
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP