When reviewing an Account’s orders, it can be helpful to see the total amount of Orders or sales the Account has had. By creating a custom currency field on the Account object and a flow to update the value each time an Order is completed, you can create a summary field without having to use one of the allowed Rollup fields.
Create a custom currency field:
- Navigate to Setup | Build | Customize | Accounts | Fields
- Click the New button in the Account Custom Fields & Relationship section
- Create a currency field with the following:
- Length: 16
- Decimal Places: 2
- Name and description
- Read Only Access
- Visible to all users that need to see the field value
- Add the custom field to current Account Layout(s)
- Save the new custom field
Create a Process Builder Flow to keep the summary field current:
- Navigate to Setup | Build | Create | Workflows & Approvals | Process Builder
- Click the New button in the right corner
- Give the process a Name and description
- Select “A record changes” to start the process from the drop-down list
- Click on + Add Object in the flow side of Process Builder
- Select Orders from the Object Drop Down and choose to start the process when a record is created or edited.
- Click Save.
- Click on + Add Criteria in the flow side of Process Builder.
- Give the criteria a name and choose Formula evaluates to true for the Executing Actions.
- Add the following formula to evaluate the Order Status field for the value of “Paid”
- You can use another field and/or value by editing the formula
- You can use a different date by editing the formula
- Click +Add Action under the Immediate Actions box.
- Give the Action a Name and choose the associated Account object as the record to be updated.
- Select No Criteria – Just update the records! for the criteria for updating records.
- Choose the field to update (e.g., the summary field on the Account).
- Select Formula for the Type.
- Add the following formula to update the summary field:
- If you are using another order total field you can edit the formula
BLANKVALUE([Order].Account.Order_Summary_Field__c, 0) + [Order].TotalAmount
- Click the Save
- Select the Activate button in the top right corner.
- Test the process and make changes as needed.
Written by Becci Gearman
Nice blog, very interesting to read
I have bookmarked this article page as i received good information from this.
Can more than one summary field be created in an object?
Yes, you should be able to just repeat the same process for a separate field. This would be like having multiple roll-up fields (I think there’s a limit that way and you’re of course limited to certain objects that have that relationship). Here, because you’re using a typical field and using a process to update, you’re only limited by the number of processes (which depends on your version). Hope this helps!
Hi,
thanks a lot for this article. I´m trying to rebuild this on our org, but I have problems on step 16. You´re using the field “Order_Summary_Field__c” for the formula. Do I have to create this or what kind of field is this?
Thanks a lot. Looking forward to an answer.
Yes, it is a custom field so that would have to be created. At the top of blog, see the first section called “Create a Custom field” as we have to build the “container” first before we start populating the data. Hope that helps!
I see, thanks a lot for the quick help! I thought the “container” is the field “Order this year”, that you used for the formula, but I guess I have to create 2 custom fields?
1. Order this year
2. Order Summary Field
or am I wrong with this ? Thanks a lot, great content!
I see, thanks a lot for the quick help! I thought the “container” is the field “Order this year”, that you used for the formula, but I guess I have to create 2 custom fields?
1. Order this year
2. Order Summary Field
or am I wrong with this ? Thanks a lot, great content!
No, actually it should just be one field, which is the Order Summary. The “Order this year” is not a field, but more of a formula that’s moving to true or false (Step 10 above). I hope that makes sense. Be sure to also check out our Youtube page where this video is.
https://www.youtube.com/watch?v=YjhE6CeZxQ0
Alright, I got it now! Thanks a lot !
I’m wondering how the following cases are handled with respect to this solution:
1. When the order is updated and the amount is not updated, the running total should not change.
2. When the order amount is corrected, the running total should be adjusted appropriately or recalculated.
Hi Brian,
Add ISCHANGED() to the criteria so that the process only ‘triggers’ when the amount is changed. This will keep any other changes to the order from causing the update and make sure when the amount is changed, the process will trigger.
You may also need to add and OR in your trigger for when the Order is New (if you are tracking sale amounts in new orders). This would be a formula of ISNEW() && is not null.
The complete formula would be:
(ISNEW() && ) || ISCHANGED()
Becci
Hi, thanks for this. This will be helpful. Just wanted to ask, seems that this will only sum the newly created record. What if we already have an existing records? Is there a way to sum it as well?
Assuming you have set up the flow to trigger when a record is either created or edited, the solution can be pretty simple. You can add a new field in your records (limiting who can see the field if you want to avoid confusion) that will serve as a trigger to edit the existing records and get the flow to process. I would recommend you use a checkbox field. Once the field is created, you can select all your records and mass update them so that the checkbox is populated. This should result in the sums being updated in your existing records as well. Please let us know if you have any other questions.