web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / How to check current l...
Power Apps
Unanswered

How to check current login user is part of a specific group or not?

(0) ShareShare
ReportReport
Posted on by 6

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 !

Categories:
I have the same question (0)
  • Community Power Platform Member Profile Picture
    on at

    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

  • nickellis74 Profile Picture
    432 Moderator on at

    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.

  • aaaaaaaaaaa Profile Picture
    6 on at

    Hi,

    This is SharePoint group called "OP-Approvers".

     

    Thank you !

  • nickellis74 Profile Picture
    432 Moderator on at

    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

     

  • WarrenBelz Profile Picture
    153,034 Most Valuable Professional on at

    @aaaaaaaaaaa ,

    I have a blog on this subject that may assist you.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 717 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 329 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard