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 2 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.
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.
After Step 1, select custom solution here select ContactCustomizations custom solution as shown in the below figure.
After Step 2, in ContactCustomizations custom solution open Contact Entity and then click on Business Rules tab and then Click on Add business rule as shown in the below figure.
After Step 3, a new Business rule window get’s opened up provide Business Rule name and meaningful description and provide condition if Vaccination field have yes as shown in the below figure.
After Step 4, if 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.
For Set Field Value Give 50 % Discount provide the values also provide in the same way Set Field value for the 2nd condition as 0 as shown in the below figure.
After Step 6, in the else part of 2nd Condition if 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.
After Step 7, save Business Rule, provide the scope as Entity and Activate this Business rule and look for any validation errors by clicking in Validation link as shown in the below figure.
After Step 8, let us test this Business rule open any contact record and verify if vaccination is Yes then discount is shown as 50 shown in the below figure.
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.
- 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 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.