-
-
Notifications
You must be signed in to change notification settings - Fork 33
Description
Rollup to Ultimate Parent is presenting several issues. I have tried to test scenarios to find a pattern but it is not always clear. In general, the counts don't seem correct. Specifically I have noticed and replicated these when using a distinct count with ultimate parent:
- Deleting rolling-up child record from the ultimate parent causes the count to decrease by 2x the regular parent's number of children.
- Adding a rolled-up child record to the ultimate parent causes the count to increase by
1 + 2(regular parent # of children). - Deleting a rolled-up child record from the regular parent causes the count to decrease by the remaining number of children on the regular parent. (Regular parent had 14 children, I delete one, the regular parent now has 13 children and the UP's count decreases by 13).
- Adding a rolled-up child record to the regular parent causes the count to increase by the new number of children. (Regular parent had 13 children, I create one, the regular parent now has 14 children and the UP's count increases by 14).
- Also, using the Recalculate Rollups LWC button on the ultimate parent only counts the ultimate parent's children.
I am less certain of how Ultimate Parent should work so perhaps I am mistaken. Are children from the ultimate parent supposed to get counted? In the wiki article example:
In this example, it's possible using Apex Rollup to take information from Contacts A, B and C and roll them all up to Account A.
If Account A had children, is Rollup to Ultimate Parent intended to count Account A's children also with Account B and C's? If A had its own child Contact X, should an ultimate Parent rollup COUNT result in four? This was the assumption I was operating on.