CRM Calculated Fields
In Microsoft Dynamics CRM Calculated Fields supports you to perform the manual calculations used in your business processes.
Let us take three CRM Calculated Fields:
- Stationery Cost
- Machine Cost
- Production Cost
See the screenshot given below:
We have created the above-mentioned 3 fields as decimal numbers with Simple Type. Total cost field will be created as a decimal type.
As specified the total cost contains the sum of the stationery cost, machine cost, and production cost. When we click on the ‘Edit’ button in the above form, we will get another form where we can enter the calculation logic of that field. Check the following screenshot.
Here is the condition If the name field contains information, the total cost should be the sum of stationary, machine and production costs.
Once the calculation is written, then save the business rule, the field and include all the fields to the form, then publish the customization.
In Dynamics CRM, open the form and enter the value for the stationery cost, machine cost, and production cost. Then save the form. After saving, just reload the page, the value of the total cost will be shown as shown below.
Advantages of CRM Calculated Fields:
- Support to eliminate the complexity of the business rules in forms.
- Field value remains locked. We can’t edit manually.
Disadvantages of CRM Calculated Fields:
- Updates to these fields won’t trigger workflow updates.
- Fields are not available as part of creating or update plugins, only available for the retrieve.
Roll up Fields
Roll up the Fields is one of the interesting features implemented in Dynamics CRM 2015, which provides the method to perform high-level aggregation from child records to its parent record.
Let us take the example to understand the implementation and working of Roll up fields. Suppose if we wish to calculate the total number of the contacts associated with the parent account. To do this we can use a Roll up the field.
According to the example, we can set the field type as Roll up and the information type as the Whole Number. When we clicking the ‘Edit’ button in the above form, we get another form where we enter the calculation logic of that field.
- Source Entity – The default entity for which the Roll up the field is created. In our example, the Source Entity will be Account.
- Use Hierarchy can be set to Yes or No for utilizing the parent-child account relationship. In the example, it should be set to ‘YES’ because we want to get the aggregation for all the child accounts of the parent account.
- Filters– Here we can apply the filter for our source entity.
- Related Entity – Select an entity to get an aggregation of related entity data in our roll up. In our example, we select the contact as a related entity because we wanted to calculate the total count of all the active contacts associated with an account.
- Filters– Here, we can apply a filter for our related entity.
- Aggregation– Here we specify the aggregation function, which we want to apply in the roll up the field. In the example, we wanted to count all the contacts.
Now we can create a new account. Now the roll up the field has zero number of child contacts. We can add contacts related to this account by using the ‘+’ on the right side of the form.
When we click on the ‘+’ button, we will get a quick form to create contacts related to that account. Fill the details in the contact form and then save that form.
After saving the contact to the account, refresh the Roll up the field. Now Rollup the field value will be updated to 1.
Advantages of Roll up fields:
- You can create the roll-up fields just like how you create the regular field.
- The wide selection of the aggregate functions, such as SUM, COUNT, MIN, or MAX.
- Full filter help can be set to source entity or related entity while using the multiple conditions.
Disadvantages of Roll up fields:
- An automatic update can be set for a minimum of one hour.