Answered by:
Calculating Parent Total from Related Child Rows

Question
-
Hi there,
I have a Parent Entity, with a 'Total' attribute. The Sum of Charges in the Child Entity rows equal the parent Total.
I'm going to write a Custom Workflow to update the Parent Total whenever a Child Charge is updated.
Before doing so, are there any tools within CRM to do this? Or are there any other methods I should use?
I'm sure others have done this many times before, so any comments much appreciated.
Thanks
JoeFriday, January 29, 2010 2:59 PM
Answers
-
Hi,Gentlemen: Using javascript will only calculate the total when the form, with thescript is open.If som users port new entries and others are using advanced find or reports, they canonly depend on the totals if the formis open.Write the custom workflow..... On change to the attribute you want to calculate the sum of, registrer the plugin that iterate through all child records......BregdsB
- Marked as answer by Joe.com Monday, February 1, 2010 9:54 AM
Friday, January 29, 2010 5:34 PM -
Hi Joe,
Look for the following book 'Programming Microsoft Dynamics CRM4.0 by Jim Steger and Mike Snyder'. It contains a custom workflow example called 'calculate related aggregate' which shouldn't be far off from what you're trying to do.
Regards,
Rob
CRM4 MBSS- Marked as answer by Joe.com Monday, February 1, 2010 9:54 AM
Saturday, January 30, 2010 9:06 AM
All replies
-
Hi,
If i am getting your requirements properly,It seems you can write javascript for that.
You can use crmwebservice update method to update 'Total' while child charge is updated.
Hope it will help you !!!
MahainFriday, January 29, 2010 3:18 PMModerator -
Thanks Mahain
Is there a SUM type function that can be used with a BusinessEntityCollection or do I have to iterate through all Child Entitiy Records in order to get the total?
Thanks
JoeFriday, January 29, 2010 4:05 PM -
Hi,Gentlemen: Using javascript will only calculate the total when the form, with thescript is open.If som users port new entries and others are using advanced find or reports, they canonly depend on the totals if the formis open.Write the custom workflow..... On change to the attribute you want to calculate the sum of, registrer the plugin that iterate through all child records......BregdsB
- Marked as answer by Joe.com Monday, February 1, 2010 9:54 AM
Friday, January 29, 2010 5:34 PM -
Hi Joe,
Look for the following book 'Programming Microsoft Dynamics CRM4.0 by Jim Steger and Mike Snyder'. It contains a custom workflow example called 'calculate related aggregate' which shouldn't be far off from what you're trying to do.
Regards,
Rob
CRM4 MBSS- Marked as answer by Joe.com Monday, February 1, 2010 9:54 AM
Saturday, January 30, 2010 9:06 AM -
The crm book has a very nice example of how to implement a feature for calculating on any entity and a child entity.....And the book is full of very good explenations and samples.BrgdsB
- Proposed as answer by BJJ Saturday, January 30, 2010 10:58 AM
Saturday, January 30, 2010 9:35 AM -
Thanks very much Rob, BJJ
I appreciate your comments.
JoeMonday, February 1, 2010 9:54 AM