Salesforce Tips: Roll-up summary with formula fields
July 5, 2012 /
Posted in Salesforce Corner, Tips and Tricks
Can Roll-up summary field works with Formula field? The answer is Yes and No.
Yes if the Formula field is not referring to a field from foreign object. Let me give you an example:
Project (Parent object)
- Project Name (Text 50)
- Due Date (Date)
- Total Cost (Roll-up Summary : Sum of all child Project Items Calculated Cost)
Project Item (Child Object)
- Project Item Name (Text 50)
- Item Quantity (Number 18, 0)
- Item Price (Currency 16, 2)
- Calculated Cost (Formula = Item Quantity * Item Price)
No, if the Formula field is referring to another field in a different object. Let me use the same example:
Project (Parent object) (Same as above)
Project Item (Child Object)
- Project Item Name (Text 50)
- Item Quantity (Number 18, 0)
- Related Item (Lookup : Product)
- Calculated Cost (Formula = Item Quantity * Product.Price)
Note that the Calculated Cost is now referring to a field called Price in the Product object. Because of this reason, the Roll-up Summary field (Total Cost) in the Project Object will not work anymore.