SFDO-Community/declarative-lookup-rollup-summaries

Object related to itself does not seem to work

mkdjns opened this issue · 12 comments

Attempting to add a Rollup Summary where the same object os on both sides of the relationship doesn't seem to work. For example, the rollup in this screenshot does not update the Parent Account when modifying the Child Account

screen shot 2014-01-21 at 8 02 38 am

Ah, scratch that. I was misunderstanding how the trigger understood what it needed to do. I was assuming that by creating the relationship (that is, by populating ParentId) the parent account would be updated to reflect the NumberOfEmployees on the newly related account. I seems that you must modify the field that is being rolled up.

Yes thats correct, it has some optimisations in it to compare the rollup field for changes and thus avoid excessive queries if nothing has actually changed. Are we cool to close this issue you think?

I think so. It would be nice to have the rollups recalculated if a relationship is added/deleted, as that's my initial use case for this. But, also understand how intensive that may be.

I am working at present on the Calculate and Schedule modes, just got back from a long US trip, so maybe next weekend for release. In the meantime, when you say 'recalculated if a relationship is added/deleted', can you clarify the steps, i think i know what you mean, just want to confirm. Thanks!

So, per the screenshot I attached, I was expecting that creating a new relationship between two accounts (using the ParentID field) would recalculate TotalEmployees__c on the parent account if I populated ParentID on the child account. Similarly, if I removed the relationship (set ParentID to null) or changed it (set ParentID to some other account) I would expect the rollup to be recalculated for all of the involved accounts.

A simpler version of my use case is to think about tallying number of employees for Starbucks. Starbucks corporate is the parent with local stores as children. If I learn about a new store, I can add it to Salesforce with the number of Employees, set the ParentID to Starbuck Corporate, then sen the TotalEmployees__c field on the corporate account update with a new total.

Ah I understand, this is a bug in my view, i'll take a look, thanks!

Taking a look at this now! :-)

Good news, i've just committed a fix for realtime mode to support re-parenting, it will be released in the next package release when i complete the schedule mode (partially implemented in this latest commit also), which will hopefully be out very soon!

That's awesome! Looking forward to giving it a test drive.

Mike

On Feb 7, 2014, at 7:19 AM, Andrew Fawcett notifications@github.com wrote:

Good news, i've just committed a fix for realtime mode to support re-parenting, it will be released in the next package release when i complete the schedule mode (partially implemented in this latest commit also), which will hopefully be out very soon!


Reply to this email directly or view it on GitHub.

I've just released v1.6, see the Readme and my blog for details! :-)

Andrew - I'm working on a rollup that is working in the normal sense of parent child objects. But my parent object is Accounts and my record has a Parent Account. How come the rollup isn't calculating the total sum of child records (across all the child accounts) on the Parent record? does this functionality work? I JUST installed the tool today on the org so it's the latest and greatest version! Please advise. Thanks!!

Have you seen this?