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