Introduction:
We all know, PowerApps, helps you build business apps.
The potential that PowerApps beholds is humongous.
PowerApps can help us build an app as basic as a Survey App or maybe a complex one which could have a potential of being a calculator.
Well! This blog post is dedicated to describing one of the most basic yet powerful piece of PowerApps, “Rules”.
Consider a scenario, you have a Survey App where based on the value of one field you need to show/hide another field.
To achieve this, it is as simple as creating a Business Rule in Dynamics 365 Customer Engagement.
Let’s dive into the nitty-gritty of it.
So, we have a field on the Survey App called “Reason why you like us?” (As shown in the below screenshot) it is a drop-down field. If the user were to select the value “Others”, it’ll show a text area for the user to write down his comments. If the user selects any other value then the text area for the comments would get hidden.
Let’s see how to achieve this,
Step 1:
Select your component (in my case it is the Text Area), go to the Rules section on the right-hand side, click on + New rule.
Step 2:
You’ll get a screen, type in your condition. In my case, I wanted to base my logic off of the Drop-Down value. If ‘Others” is selected show the Text Area otherwise hide the Text Area.
Step 3:
Now, comes the step to apply our Action. Click on Define actions, it’ll take you to the app screen.
Here, you need to select the field on which you want to perform the action (in my case it the text area) and also we need to define the action (in my case it to set the visibility).
In order to set the action to Visibility True, click on the Visible property (you might have to toggle the value in order to get your desirable output) on the right hand side and then click on Done at the top.
Once, it is done, you’ll see the action as below.
Step 4:
It’s time to define the else part of the above logic.
Note:
- We can group multiple fields in the condition to alter the properties of another field.
- Currently, the conditions don’t support ThisItem property, which we usually use in a gallery or form.
Conclusion:
Following similar steps, you can alter not only the visibility but all the properties of a component.