Hi,
I have a PowerApp which is shared to a Security Group.
However, I want users to only see certain features based on what ‘department’ or they are in.
What’s the best way to accomplish this?
I was hoping to create a SP list which shows all members of the security group in a column. I would then have another column called ‘department’ and another column ‘Access Level’ (Admin, Basic, etc…)
When the app starts, the user can be checked against the list and relative information displayed.
Any way to achieve this?
Thanks.
Solved! Go to Solution.
@gmbeee ,
Possible, but a whole different process, particularly if multiple departments were allowed access - you then have a many-to-many query which involves a looping collection - I have a blog on it here.
You also have to assume the user has the one access level to all Departments.
The OnStart
Set(gblUser,User());
Set(
gblAccess,
LookUp(
RefListName,
YourEmailField = gblUser.Email
)
)
would return a Record variable where the Departments field gblAccess.Department.Value is a Table of departments the user has access to and the AccessLevel field gblAccess.AccessLevel is their access level, however if the user has different levels of access to different departments, how are you going to show that?
Where you go from there depends (and it is unclear in your posts) exactly when and where you are testing and what you want returned. Can you also please attempt some code based on your actual values - happy to look at it.
Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.
Hi @gmbeee ,
Probably the best way if you want to control the result is to have a reference list (which I do) with the user's email (which is unique) and any other attribute you want to query. In your case, you would do something like this at App OnStart
Set(gblUser,User());
Set(
gblDept,
LookUp(
RefListName,
YourEmailField = gblUser.Email
).Department
);
Set(
gblAccess,
LookUp(
RefListName,
YourEmailField = gblUser.Email
).AccessLevel
)
The Variables gblAccess and gblDept would then contain the values you need.
Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.
Hi Warren,
That’s really helpful. Thanks.
Would this work if I had multiple selections enabled for a choice column for the ‘Department’ column…
I’ll test your solution out tomorrow. Thanks again.
@gmbeee ,
You have the user's Department, so your query would simply be an Or() statement (If gblDept = xxx or gblDept = yyy)
Ok, I get that. What I’m unsure about is, if I assign more than one department to a user in a share point list column via a choice column. Can the variable be a record or table with more than one choice?
@gmbeee ,
Possible, but a whole different process, particularly if multiple departments were allowed access - you then have a many-to-many query which involves a looping collection - I have a blog on it here.
You also have to assume the user has the one access level to all Departments.
The OnStart
Set(gblUser,User());
Set(
gblAccess,
LookUp(
RefListName,
YourEmailField = gblUser.Email
)
)
would return a Record variable where the Departments field gblAccess.Department.Value is a Table of departments the user has access to and the AccessLevel field gblAccess.AccessLevel is their access level, however if the user has different levels of access to different departments, how are you going to show that?
Where you go from there depends (and it is unclear in your posts) exactly when and where you are testing and what you want returned. Can you also please attempt some code based on your actual values - happy to look at it.
Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.
User | Count |
---|---|
122 | |
87 | |
86 | |
75 | |
67 |
User | Count |
---|---|
214 | |
181 | |
137 | |
96 | |
83 |