Showing Restricted or Role-based Users in PowerApps Form Dropdown

Introduction

Security of their app or data or functionality everyone demands. Most of the requirements require an approval process and if we have limited approvers listed what could be asked for more?

Scenario

In this article, we shall see how to enable multiple users to play their roles in PowerApps forms.

Objective

Design our form as per our needs. I have my form, which is required to be filled by the user. The HR associate will review the form, and the HR head will approve the request. To make data storage flexible, we shall be using lists to maintain a list of HR reviewers and HR heads. We shall have one list to maintain the details. Only for display purposes, we shall be fetching the details from a separate list and after the selection of a person, we shall save the value in the main desired list.

Step 1. List

My list looks like below. Here mylist will have HR reviewers and HR names stored in the people picker column.

List

From the below screenshot, we can either have the HRHead column filled or blank. The formula in PowerApps will handle to fetch the values.

HRHead column

Step 2. Form

My form looks like this: where HRReviewer and HRHead are shown. Also, as we know, without unlocking the Datacard, we can modify any property or write the formula. We need to unlock both (HRHead, and HRReviewer) the datacards first.

Form

Step 3. Connect your datasource

After connecting to datasource only we can use this datasource in the formula to populate the items.

Data

Step 4. Write Formula on Items Property of HRHead datacardvalue

Whichever datacard has to show limited people, Items property of those datacard value the formula has to be written. Items property formula has a condition so that condition has to be modified as per the need. In my case, I just want to show rows that do not have blank values. Similarly, we can maintain a flag column with values that show and hide. If it is a show value, then only show; otherwise, those rows with hide values will not appear in the dropdown.

Items Property

Items Property

Step 5. Write Formula on Items Property of HRReviewer datacardvalue

In HR reviewer we have two entries so the below screenshot shows two values. Above we can see the HR head as one entry.

Values

Editing

Note 1. People Picker is a complex column so the value of the People Picker column has to be populated with the above format as shown in the image.

Step 6. Verify DefaultSelectedItems property of Datacardvalue

DefaultSelectedItems

Step 7. Verify Default property of Datacard

Datacard

Step 8. Verify Update property of Datacard

Update property

Step 9. Mandatory to keep the IsSearchable property to false only

IsSearchable

Step 10. Impact Analysis

This approach does not impact existing data in the same column. We can edit the form and save it with previous entries that could not be part of a limited user. This note is applicable only if this implementation is being enhanced after the app goes live.

Conclusion

In the above article, we learned how to show limited users from a list and save the person in the main list. In this way, we can have limited approvers or specific roles in the required columns. This approach helps in risk management and avoids security breaches. The list in this case HR Approver Role can have permission broken which does not let all users see the entries of that list and also no one can modify any data.


Similar Articles