I have a custom object named Milestones (with a field named MilestoneType) that has a Master-Detail relationship to Contact. I want to build a report where I can pull all contacts that have a milestone with a milestone_type of Deacon, but exclude those that also have a milestone_type of Retired. How do I build the report so that this conditions are met?
2 Answers
You can do this with Custom Report types (CRT). First, create a custom report type for Contacts with Milestones by going to My Name -> Setup -> Create -> Report Types
. Choose Contacts as the base object and then add a relationship for Milestones.
Create a new report based on the new CRT and you can filter on MilestoneType:
Unfiltered:
Filtered:
Edit To show only Contacts who are Deacons and NOT retired we need to use cross-filters.
Unfiltered, showing updated Contacts. Note that the Contact "Second Test" has milestone types of both Deacon and Retired, while the other is just Deacon.
By setting a cross-filter of Contacts without Milestones and Milestone Type equals Retired
we filter "Second Test".
-
first off ty. How would I report on all contacts that are deacons and that are NOT retired?– fourqOct 17, 2012 at 19:01
Create two roll-up summaries on Contact. One that counts all milestones where type equals 'Deacon' and one that counts all milestones where type = 'Retired'. Then report on all contacts where deacons > 0 and retired = 0.
I don't believe there is a way to directly build this in a report without adding these roll-ups on the contact.
-
@gringriforce I like this answer. I was also thinking about creating a trigger that would update a text field with a semi delimited string of all milestones. If I did it with a text field would I be able to report against it?– fourqOct 17, 2012 at 3:59
-
@fourq Yes, if you had a text (or multi-select picklist) field like Deacon;Retired;... you could definitely report against that but I would avoid creating a trigger if you don't have to. Oct 17, 2012 at 4:14
-