A colleague of mine reminded me today of an under-used feature of Salesforce Reporting, Cross Object Filters so I thought I'd write a quick blog about them.
What are they and when might I need to use them?
What are they and when might I need to use them?
What are they?
Cross filters are used to further limit your results by including or excluding records from related objects and their fields. You can apply cross filters by themselves, or in combination with report field filters.Sample Use Case
We want to add Contacts to a campaign who have made a donation of over $100's in the past year excluding in honor/in memory of donations.
Why is this a good Use Case? We need to base our report on Contacts in order to take advantage of the Add to Campaign button from a report but we need to limit our data by information only found on the opportunity record such as the in honor/in memory of indicator.
How do we do it?
In this case we'll want to create a report based on Contacts and Accounts but we will leverage the cross filter using the WITH condition to show Contacts WITH opportunities in the last year over $100 that are not of type in honor/in memory.
First we'll create the report based on Contacts and Accounts
Next we'll add any filters we want to use from the Contact or Account object. In my example I'm excluding anyone who has the indicator on their contact record of Do Not Contact.
Now we will add our cross filter. I am cross-filtering on the opportunity object and selecting any contacts that have opportunities that are not of type Honor or Memorial.
I'll start by choosing Add Cross Filter from the filters drop-down.
This will bring up the Cross Filter screen where I can choose my "Show Me" options. I want to see Contacts WITH Opportunities so I'll choose With from the drop-down and Opportunities as the Secondary Object and click Apply.
Next I'll click on the Add Opportunities Filter to add my filter to exclude tribute type gifts.
I search for my opportunity field, in this case Tribute Type, choose the Operator of not equal to and choose the values that I don't want included (Honor and Memorial). Then click Apply. We can add additional filters like gift amount if desired by repeating this process.
Now my report contains filters from the Contact object (top) and Cross filters from my Cross filter object (bottom).
At the time of this blog posting, the Add to Campaign button feature is not available in Lightning. To see the Add to Campaign button. Switch to Classic view and Run the report.
Note: When I run the report, I can only display fields from the Report Type objects (Contacts and Accounts). Fields from the Cross Filter object are not available to add to the display results.
For more information on cross-filters see these awesome resources.
- This Salesforce video shows how to use cross-filters (lightning experience)
- This documentation explains how to use them and the types of cross filters.