2

We currently have a custom object called 'Buildings' then under that we have our Accounts (Standard object) & Opportunities (Standard). We are trying to calculate the total 'Closed MRC' (Monthly Recurring Charge) field on each Opportunity.

I added a new field called 'Sales MRC Total' on the Account, making it a rollup field from the related Opportunities. We now need to add one more rollup field on the custom object Buildings to sum the Total MRC from all the related Accounts under the Building.

I don't think I am able to use rollup fields with custom objects, so I wanted to see if there could be a way to achieve this using apex?

1

You can easily do this using either a trigger of your own design or Roll Up Helper which is free app on the App Exchange.

  • Thanks!! I am a fairly new admin and haven't written any triggers yet, but this Roll Up Helper App is great and works perfectly for our need! – JazzyJ Jul 6 '15 at 14:25
  • Turns out only the paid version allows for the real-time roll up :( – JazzyJ Jul 6 '15 at 15:02
  • 1
    Sorry to hear that. The code for it is also available as a repository on GitHub at github.com/afawcett/declarative-lookup-rollup-summaries. You should be able to use that to install it as an unmanaged package. – crmprogdev Jul 6 '15 at 15:37
0

First of all, roll up summary fields are only for Master-Detail relationships. You could usually do this with a custom object, except that in your case, you can't have a standard object as the detail in a Master-Detail relationship.

This does look like a task that requires Apex.

0

You can do this with clicks instead of code with Process Builder (PB) and/or Visual Workflow (flow).

Set the criteria just like you would work a workflow rule. Best part is you can have different actions based on the conditions in one process, such as add the amount on the Account to the Building when the Amount changes on the account and when the account is associated with the building, but subtract the Amount from building total when the account is unassociated with the building.

These can help you get started if you haven't used PB or flow before:

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.