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
Debbie ChrysochouDebbie Chrysochou 

Calculate all Order Amounts of a single account into one field


Scenario 1

One Account has made 5 orders. Each Order has it's Order Amount. Would it be possible to create a custom field to sum up all those Order Amounts?
Debbie ChrysochouDebbie Chrysochou
Hi BalaYesu,

Thank you fro your reply. Unfortunately roll up summary field is not woking in this case as the Order Amount is a field of Orders. As you stated the roll up sum field works for parent record when it comes from a child record field. 
Debbie ChrysochouDebbie Chrysochou
So I need to create a custom lookup relationship in Orders
 User-added image

After I create the field. How do I create the roll up summary since it is for order products. 
User-added image

User-added image

Lets say the Order Amount for 3 different orders is 500 euros each. So the outcome that I want is a field that will say 1500.
We cannot create roll up summary field for a lookup relation ship. For roll up summary field, it has be to master-detail relationship.

I am not sure the purpose of the field. But can achieve this creating a summay report.

Or by using aggregate functions in apex code in a trigger to sum the order amount and store it at account level.