Search This Blog

Tuesday, October 4, 2022

Business Rules With Actions Set Business Required/Visibility In Model Driven Power Apps

 Introduction

In Dynamics 365 CRM or Power Platform, business rules provide a simple interface to implement and maintain fast-changing and commonly used rules to set and clear field values, set field requirement levels, show or hide fields, enable or disable fields, validate and show error messages. Every business rule will have components and properties. And every component will have Actions and Flow[Condition]. Every business rule starts with a condition. In this article, we are going to see about 2 Actions, Set Business Required and Visibility, with a business scenario on a contact entity.

Step 1

Login to the required Dynamics CRM/ Power Apps environment using URL make.powerapps.com by providing the user name and password as shown in the below figure.

Business Rules with Actions Set Business Required/Visibility in Model Driven Power Apps

Step 2

Create a solution with the required entity/table to create a business rule, if you want to know about how to create a solution, you can refer here and select the solution as shown in the below figure.

Business Rules with Actions Set Business Required/Visibility in Model Driven Power Apps

Step 3

Open ContactCustomiazations solution and click on entity/table contact as shown in the below figure.

Business Rules with Actions Set Business Required/Visibility in Model Driven Power Apps

Step 4

After step 3, go to contact entity/table and then create below custom(user-defined) columns as shown in the below figure.

Business Rules with Actions Set Business Required/Visibility in Model Driven Power Apps

Step 5

After step 4, click on Business rules and then click on Add business rule as shown in the below figure.

Business Rules with Actions Set Business Required/Visibility in Model Driven Power Apps

Step 6

After step 5, a new tab gets opened, provide Business rule name and relevant Description and keep Scope as Entity by default and click on save as shown in the below figure.

Business Rules with Actions Set Business Required/Visibility in Model Driven Power Apps

Step 7

After step 6, you will encounter validation Failed! shown in the below figure.

Business Rules with Actions Set Business Required/Visibility in Model Driven Power Apps

Step 8

After Step 7, Provide Condition Name and select field Birthday custom field and operator Contains Data and clicks on Apply shown in the below figure.

Business Rules with Actions Set Business Required/Visibility in Model Driven Power Apps

Step 9

After step 8, still we see 1 validation error. Now we have to provide 2 Business Required Actions from Actions Section and have to drag and drop Action and give it to true and false part of Condition and provide values as shown on the right side of the window and click on Apply you should see validation error goes off as shown in the below figure.

Business Rules with Actions Set Business Required/Visibility in Model Driven Power Apps

Step 10

After Step 9, now take another Action Set Visibility and then drag and drop to the right side of Set Business Required If Birthday has value as shown in the below figure.

Business Rules with Actions Set Business Required/Visibility in Model Driven Power Apps

Step 11

After step 10, as 1 validation failed error is shown at the top and another at the top of Set Visibility New Action, click on Set Visibility Action and provide field Discount and give Visible value as Yes and click on Apply as shown in the below figure.

Business Rules with Actions Set Business Required/Visibility in Model Driven Power Apps

Step 12

After step 11, provide Set Visibility Action to both Set Business Required Actions in Step 9 and click on Apply you could see validation successful message as well as shown in the below figure.

Business Rules with Actions Set Business Required/Visibility in Model Driven Power Apps

Step 13

After step 12click on Save Button and click on Activate button of the Business Rule window and close it and go-to solution and publish it as shown in the below figure.

Business Rules with Actions Set Business Required/Visibility in Model Driven Power Apps

Step 14

After step 13open a new contact record and select the Information form from Contact Dropdown and set Birthdate, and see Vaccination Field as required Field and Discount field will be also shown as shown in the below figure.

Business Rules with Actions Set Business Required/Visibility in Model Driven Power Apps

Step 15

After step 14, in the same way, if we make the Birthday Field empty, then the Vaccination field will become not Business Required or non Mandatory and the Discount field gets hidden as shown in the below figure.

Business Rules with Actions Set Business Required/Visibility in Model Driven Power Apps

Note

  1. Please make sure you keep the required fields on Contact Form.
  2. Select fields for Actions as well as for Conditions without fail.
  3. Make sure to Activate Business Rule after saving.
  4. Publish all changes without fail.
  5. Give the name of conditions and Actions in a meaningful way.

Conclusion

In this way, one can easily perform commonly used business rules  and Business Required and Visibility Actions can be built in a few minutes.

References :Business Rules Resources (c-sharpcorner.com)



No comments:

Post a Comment