If you need to display calculated fields on a form, for example, we may have a few fields and we want to also have the total on the form. CRM gives us a Field Type option we can use to calculate fields. This field type option is called Calculated Field.
Let’s take a hypothetical example, where we have a few fields and we need to display the calculated total. So we have the actual item cost, the assemble cost and optional accessory cost. We want to have a field for the total cost of the assembled item.
The process is outlined below:
- Lets go ahead and create the three fields.
- Item Cost
- Assembly Cost
- Optional Accessory
- Next, lets add the Calculated Field. Make sure you set the Field Type as “Calculated”.
- Now, we need to add the calculation logic. Click on the “Edit” button.
- This brings up the calculation business rule:
- Enter the condition, here we are just entering one condition to check if the Item Cost is greater than 0 or not.
- Enter the calculation logic. Select the field and then type in the operation, “+” in our case and then select the next field.
- Once the Calculation has been setup, save the business rule, the field and add the field to the Form. Publish the customization.
- In CRM, open the form and enter the value for Item Cost, Assembly Cost and Optional Accessory.
- Then save the form. On Reload, the value of the Total Cost will be displayed.
Calculated fields are also closely related to Roll-up fields. These allow you to calculate across child records.