function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Sree007Sree007 

How to calculcate sum of child amounts

I have case header having a field called total billed amount. I have other cases as line items having a field called billed amount. Now, I want to auto-calculate the header total billed amount as sum of line items billed amount. Is it possible?

 

Also how do I differentiate between header and line items for the case? I am thinking of having record types or having a picklist to choose between header and line items. Please advise.

Best Answer chosen by Admin (Salesforce Developers) 
forcedotcomforcedotcom

Hi,

 

I don't fully understand what you are trying to achieve but hopefully this may help. To sum multiple child objects to a parent you will need a roll-up summary field on the master object, and you will need a master-detail relationship in place.

 

If this isn't the case it is possible to do using Apex triggers.

 

I may have misunderstood but I don't believe you can do what you're after using a Formula field.

 

forcedotcom

All Answers

forcedotcomforcedotcom

Hi,

 

I don't fully understand what you are trying to achieve but hopefully this may help. To sum multiple child objects to a parent you will need a roll-up summary field on the master object, and you will need a master-detail relationship in place.

 

If this isn't the case it is possible to do using Apex triggers.

 

I may have misunderstood but I don't believe you can do what you're after using a Formula field.

 

forcedotcom

This was selected as the best answer
Sree007Sree007

Hi,

Thanks and it did answer my question. I guess I have to forego this feature in my installation, as with master-detail relationships, I cannot have different owner for child records, but my installation require different owners. So I was looking for a formula field, which is not possible with current SFDC release.

Thank you very much

Sree