Hi All,
I have a group called "OP-Approvers". I have a button called "Approve" on powerapp form. Now what I want, when user open powerapp form it should check if current login user is part of "OP-Approvers" group then only show the "Approve" button else hide the "Submit" button.
Please help. your help is much appriciated.
Thank you !
I have a blog on this subject that may assist you.
OK. So you need to use the Office 365 Groups connector to read the group members list.
From memory, you're then going to use an If something like this:
If(IsBlank(Filter(Office365Groups.ListGroupMembers("GROUP ID GOES HERE").value,mail=User().Email)),"Not an approver","Is an Approver");
Your tenant admin can tell you the Group Id (office.com, open Admin, Groups and Users, Active Groups, select the group, look for a GUID in the URL).
Breaking that apart from the middle out
Filter(Office365Groups.ListGroupMembers("GROUP ID GOES HERE").value,mail=User().Email)
That part filters the members list of the group to just the people whose email address is the same as the logged in user (which in practical terms means to just that user).
IsBlank() determines whether there's anything in that list. If there is then the user is an approver, if not then they're not. And the If then simply switches the behaviour accordingly. I've used simple text but I guess in your scenario you're going to either use it on the visibility of two different buttons, or switch the OnSelect formula of a single button.
I hope that helps. It's untested and from memory so it might need a bit of tweaking. If it does work, could you mark this as an answer? Thanks
Nick
Hi,
This is SharePoint group called "OP-Approvers".
Thank you !
What do you mean by 'group'? Is that an Office 365 Group? Or are you defining them in a table somewhere?
The answer to your problem will be different depending on how you're defining the groups.
Hi @aaaaaaaaaaa,
Use the Office365Groups connector for this.
In the OnStart of your app you could set a variable according to whether or not the user is an approver. e.g.
Set(
gblIsApprover,
User().Email in Office365Groups.ListGroupMembers("Put The Group ID Here").value.mail
)
Then you can use the variable gblIsApprover in the Visible property of your buttons
MS.Ragavendar
32
Michael E. Gernaey
19
Super User 2025 Season 1
WarrenBelz
18
Most Valuable Professional