Introduction
In Dynamics 365 CRM or Power Platform, Business rules provide a quick way of applying business conditions every business rule starts with a condition. In this article, we are going to see about two Actions Set Default Value and Set Field Value with a business scenario on contact entity if Vaccination is done, then a discount of 50% is given to contact else no discount.
Step 1
Login to the required Dynamics CRM/ Power Apps environment using URL make.powerapps.com by providing user name and password and go to solutions as shown in the below figure.
Step 2
After step 1, the select custom solution here selects ContactCustomizations custom solution as shown in the below figure.
Step 3
After step 2, in ContactCustomizations custom solution open Contact Entity and then click on the Business Rules tab and then Click on Add business rule as shown in the below figure.
Step 4
After step 3, a new Business rule window gets opened, provide Business Rule name and meaningful description and provide condition if Vaccination field have yes as shown in the below figure.
Step 5
After step 4, if the Vaccination value is yes then drag and drop Set Field values against to Condition and then keep Set Field Value for Discount field as 50. If Vaccination is not taken then keep another condition and verify if Vaccination value is No or None set Field Value for Discount field as 0 as shown in the below figure.
Step 6
For Set Field, Value Give 50 % Discount provides the values. Also provide in the same way Set Field value for the 2nd condition as 0 as shown in the below figure.
Step 7
After step 6, in the else part of the 2nd Condition if the user did not select any vaccination value then assign the default value as 0 by selecting Set Default Value by drag and drop it as shown in the below figure.
Step 8
After step 7, save Business Rule, provide the scope as Entity and Activate this Business rule and look for any validation errors by clicking on the Validation link as shown in the below figure.
Step 9
After step 8, let us test this Business rule. Open any contact record, and verify if vaccination is Yes then the discount is shown as 50 shown in the below figure.
Step 10
After step 9, for the same contact record, verify if vaccination is No or None then discount is shown as 0 shown in the below figure.
Note
- Please make sure you keep the required fields on Contact Form.
- Select fields for Actions as well as for Conditions without fail.
- Make sure to Activate Business Rule after save.
- Publish all changes without fail.
- Give the name of conditions and Actions names in a meaningful way.
Conclusion
In this way one can easily perform Business validations with Set Default Value and Set Field Value Actions in few minutes can be built.