Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Apps - Building Power Apps
Unanswered

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

Like (0) ShareShare
ReportReport
Posted on 3 Dec 2021 14:45:27 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:
  • WarrenBelz Profile Picture
    146,821 Most Valuable Professional on 12 Dec 2021 at 01:38:42
    Re: How to check current login user is part of a specific group or not?

    @aaaaaaaaaaa ,

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

  • nickellis74 Profile Picture
    430 Super User 2025 Season 1 on 06 Dec 2021 at 09:17:48
    Re: How to check current login user is part of a specific group or not?

    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

     

  • aaaaaaaaaaa Profile Picture
    6 on 06 Dec 2021 at 06:54:22
    Re: How to check current login user is part of a specific group or not?

    Hi,

    This is SharePoint group called "OP-Approvers".

     

    Thank you !

  • nickellis74 Profile Picture
    430 Super User 2025 Season 1 on 03 Dec 2021 at 16:19:50
    Re: How to check current login user is part of a specific group or not?

    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.

  • Community Power Platform Member Profile Picture
    on 03 Dec 2021 at 15:54:39
    Re: How to check current login user is part of a specific group or not?

    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

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

Understanding Microsoft Agents - Introductory Session

Confused about how agents work across the Microsoft ecosystem? Register today!

Warren Belz – Community Spotlight

We are honored to recognize Warren Belz as our May 2025 Community…

Congratulations to the April Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard > Power Apps - Building Power Apps

#1
MS.Ragavendar Profile Picture

MS.Ragavendar 32

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 19 Super User 2025 Season 1

#3
WarrenBelz Profile Picture

WarrenBelz 18 Most Valuable Professional

Overall leaderboard