In my last post – how to use calculated fields to get related record attributes, we were able to get the primary phone number of an account in the opportunity form using calculated fields. Now let’s look at a more complicated scenario.
I will be using the same business case:
What if there already is a phone number field and you need to populate the value in that field? Since this field is already available, you cannot directly add a calculation there.
Answer is really simple. Since we already have the required value in our new calculated field, we just need to copy this value to the relevant field using a business rule.
In this form, let’s assume that we need to populate the value in”Account Contact Number” field
You need to follow the steps mentioned in the previous post to create the “Primary Contact Number” calculated field.
Once the calculated field is ready, let’s create a business rule
Go to “Business rules” tab under the entity
Add new business rule. This will open business rule editor in a separate window
Our logic is simple. Condition – If the calculated field has a value
Action should be: Set field value – copy calculated field value to the “Account Contact Number” field
Now , let’s validate, save and activate this rule. It should now show the phone number in both fields.
Finally, we don’t need the calculated field to be visible therefore, let’s hide this field in the form.
What we have learnt so far covers getting field values of any related record via calculated fields and populate these values in form fields using business rules.
Depending on the business case, you can incorporate calculated fields with business rules in order to extend the functionality.
Categories: Dynamics 365