You need to sign in to do that
Don't have an account?
Roll Up Summary Challenge
I have a custom object called Headings that has a many to many relationship to Opportunities. I've created the junction object Opportunity Headings to show this relationship. Opportunity Headings also has a lookup relationship to Account. Headings looks up to another custom object called Category. I know it's confusing, so I'm including a picture to explain the relationships :)
I need a roll up summary field on Category (in blue above) that will count the number of Opportunity Headings (in red) with unique Accounts (in green).
I know how to do the roll-up summary field to count Opportunity Headings, but I can't figure out how to only count one per account. So ABC account could have 10, opportunity headings, but I only one to show that there in one account in that category.
I would love to hear any ideas you can come up with for this problem!!
Thanks!!
Hi Brandi,
You could update a field in category with an apex trigger on inserts or updates to Opp heading.
Have you done anything similar to this where you could share the code?
I've done a few triggers with roll-up summaries, but never one where I'm looking for a count of distinct values. I tried so many ways of writing this trigger and can't seem to figure it out.