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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Permission control not...
Power Apps
Answered

Permission control not working, cant see what i am doing wrong

(0) ShareShare
ReportReport
Posted on by 1,097

I have this code on my ONSTART

screenshot: http://prntscr.com/nok0al

ClearCollect(collAppUsers5;'Office365-grupper'.ListGroupMembers("7b606cec-bb50-438a-a262-89269ca0eb73").value);;Set(Button1Mode;CountRows(Filter(collAppUsers5;Lower(mail) =Lower( User().Email))) = 1);;

ClearCollect(collAppUsers6;'Office365-grupper'.ListGroupMembers("2ec581ed-429b-4e8e-878a-6ce10ff32b58").value);;Set(Button2Mode;CountRows(Filter(collAppUsers6;Lower(mail) =Lower( User().Email))) = 1);;

ClearCollect(collAppUsers7;'Office365-grupper'.ListGroupMembers("1749g410-e704-45f4-8507-36g6b00e68a9").value);;Set(Button3Mode;CountRows(Filter(collAppUsers7;Lower(mail) =Lower( User().Email))) = 1)

Then i have this on DisplayMode for a button.

If(Button1Mode;DisplayMode.Edit;DisplayMode.Disabled)

If(Button2Mode;DisplayMode.Edit;DisplayMode.Disabled)

If(Button3Mode;DisplayMode.Edit;DisplayMode.Disabled)

Ofc just one line per button, so in total i have 3 buttons.

 

Button1 and Button3 works fine.

My account is member of the gorup with the above ID for Button2.

But still the DisplayMode does not change.

It do change for all other buttons... but not this one. I have tried leaving the group and rejoining.. Still nothing.

 

 

Categories:
  • RandyHayes Profile Picture
    76,299 Super User 2024 Season 1 on at

    @Oskarkuus 

    Put a Label on the screen and set the Text property to:   

    CountRows(Filter(collAppUsers6;Lower(mail) =Lower(User().Email)))

    See what that displays.

  • Oskarkuus Profile Picture
    1,097 on at

    i get zero (0) as a result.

     

    That seems wrong.

    Why?

    EDIT:
    I did the same for all others, added a label and all other show 1. This one show 0

     

  • RandyHayes Profile Picture
    76,299 Super User 2024 Season 1 on at

    @Oskarkuus 

    Yes, that would be a problem if you are in that group as you suspect.

    The next thing would be to look at the collection (collAppUsers6) in the View->Collections area and see that you are getting results from that formula in the collection.

    If it is empty, then I suspect there is an issue with the GroupID.

    If it has values and you are not in it, then I suspect either a lag in the group members list being updated on the Office 365 side or some other factor.

  • Oskarkuus Profile Picture
    1,097 on at

    I created a gallery and put this in the gallerys ITEMS

    'Office365-grupper'.ListOwnedGroups()

     

    I get no results atall.

    In the gallery i have one textfield with this:

    ThisItem.ID

     

    This used to work before, but now i get error that ID is not valid.

    So i cant even get a list of my accounts groups.

     

    Also tried this in the gallery items
    'Office365-grupper'.ListGroupMembers("GROUP-ID-NUMBER")

    Same issue as above, no reults and ID is not valid o.O

     

    Could this be Microsoft doing something?

     

  • Oskarkuus Profile Picture
    1,097 on at

    Logged in with one other account.

     

    One account all but 1 buttns work.

    One account none of the buttons work.

     

    Both accounts have the same group memberships and should see exactly the same.

     

    Something is not right.

  • RandyHayes Profile Picture
    76,299 Super User 2024 Season 1 on at

    @Oskarkuus 

    The ListOwnedGroups function will return a table that has a Value column.  In that Value column is the table of all the groups.

    So, change your Gallery Items to the following formula:

    'Office365-grupper'.ListOwnedGroups().value

    Now you will have all of the group rows in the Gallery and ThisItem.id will be valid.

     

    The same goes for your ListGroupMembers function.  It will return a table with a value column.  The first record value column is what you want.

     

    You can test all of this with two galleries (Gallery1 and Gallery2)

    Items for Gallery1 - 'Office365-grupper'.ListOwnedGroups().value

    A label in the Gallery.  Set text to : ThisItem.id

     

    Items for Gallery2 - 'Office365-grupper'.ListGroupMembers(Gallery1.Selected.id).value

    A Label in Gallery2.  Set test to : ThisItem.displayName

     

    You will now see all groups you own and all members in those groups as you select them.

     

  • RandyHayes Profile Picture
    76,299 Super User 2024 Season 1 on at

    @Oskarkuus 

    So the question still remains I asked earlier, what are you getting in those collections?

    If you don't view them through the collection viewer, then at least set them as the items property of a gallery and see what is going on in them.

  • Oskarkuus Profile Picture
    1,097 on at

    I only see 5 rows of members/data in my collection.

    The group have over 30 members....

     

    So it seems i only get 5 ?!

  • Verified answer
    RandyHayes Profile Picture
    76,299 Super User 2024 Season 1 on at

    @Oskarkuus 

    First...there is data in it...that's a good thing.

    Now, if you're looking at the View->Collections area, then yes, it is limited to 5.  I sent you there as a quick check to make sure that you are actually gathering daa in the collection...which you are.

     

    So, now, I would do that next piece from before - create a Gallery and set the Items to the collection.  Then throw a label in the Gallery and set the Text to ThisItem.mail

    See if you see yourself in there - or at least you see things you expect.

  • Oskarkuus Profile Picture
    1,097 on at
    Went to sleep. Woke up. Logged in and now everything works. All buttons light up as they should.

    I have however setup your checks/steps in the app so i can search for errors next time.
    Atm this seems to be solved.

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 381 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 340

#3
WarrenBelz Profile Picture

WarrenBelz 187 Most Valuable Professional

Last 30 days Overall leaderboard