| Zoha Zulfiqar
Here is a list of functionalities that business rules can perform:
- Set values of a field
- Clear values of a field
- Set field requirement levels
- Show or hide fields
- Enable or disable fields
- Validate data and show error messages
- Create business recommendations based on business intelligence.
Let’s create a simple business rule and see how it works.
So I have created an entity called Contact Details and I want to apply a business rule to it for showing or hiding a field based on another field’s value.
First, navigate to the Contact Details entity – Business Rules – click on Add business rule. A new screen will open up for the configuration of business rule.
Here I can give a title to business rule and add a description as well.
Now there are conditions and actions in the right hand tab that I can drag and drop to the main canvas, then go to properties to specify the condition or the action I want to perform. For Show/Hide Fields business rule, I have added a few conditions and action as you can see in the picture below.
So my purpose was to show Email field when the Contact field is set to Email and to show the Phone Number field when the Contact field is set to Phone Number. Here is the text version of the business rule:
After applying all the necessary conditions and action, click on save and then validate.
And then click on Activate. If I don’t activate the business rule, it will not work.
Now let’s see the business rule in action with in the model-driven app that I created for Contact Details entity. When I first open the Main Form of Contact Details, only two fields are visible – Name and Contact.
If I set Contact field to Email, then the Email text field becomes visible and if I set the Contact field to Phone Number, then the Phone Number field becomes visible. It proves that the business rule is working as it should be.
Join us next time, as we continue our journey of learning canvas apps.Click here to learn more about Imperium's Power Apps Services. We hope this information was useful, and we look forward to sharing more insights into the Power Platform world.