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 / OnStart Set Collection...
Power Apps
Answered

OnStart Set Collection (Array) of Admin Users

(0) ShareShare
ReportReport
Posted on by 510

I might be answering my own question here so please let me know if this will work as I don't have other admin users yet. I want to define a variable which has admin user email addresses in it so that I can use the variable to control the visibility of buttons.

At this point, I have a working solution with one email address:

OnStart

 

Set(varAdmins, {Email: "myname@mycompany.com"})

 

Button Visibile Property

 

User().Email = varAdmins.Email

 

Will the button's visible property still work if I add additional users to the collection e.g.

 

Set(varAdmins, {Email: "myname@mycompany.com"},{Email: "othername@mycompany.com"})

 

My syntax might be wrong here.

Or is it as simple as something like this:

 

Set(varAdmins, "myname@mycompany.com; othername@mycompany.com")

 

 

 

 

 

 

Categories:
I have the same question (0)
  • eka24 Profile Picture
    20,923 on at

    I will suggest the following:

    OnStart

    Set(varUser,User().Email)

     

    Button Visibile Property

    varUser= "myname@mycompany.com" Or "othername@mycompany.com"

     

    ------------

    If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.

  • rwittels Profile Picture
    510 on at

    I am trying to avoid changing the email addresses on every button, especially if my admin users change. Is there no way to maintain them in one place, such as OnStart, and just use varUser = varAdmins on buttons?

    What about Set(varUser,User().Email) and Set(varAdmins,' "myname@mycompany.com" Or "othername@mycompany.com" ')?

  • Verified answer
    eka24 Profile Picture
    20,923 on at

    In that case:

    OnStart

    Set(varUser,User().Email); Set(varAdmins,["myname@mycompany.com", "othername@mycompany.com"])

     

    Then:

    Button Visibile Property

    varUser in varAdmins.Value

     

    Or create a collection:

    ClearCollect(
    AdminsCol,
    {AdminsMail:"othername@mycompany.com"},
    {AdminsMail:"myname@mycompany.com"})
     
    Then Visible property:
    varUser in AdminsCol.AdminsMail

    ------------

    If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.

  • rwittels Profile Picture
    510 on at

    This works with my address so I'm sure it will work when I add additional addresses.

  • eka24 Profile Picture
    20,923 on at

    That is correct. It will work when you add more. 

    ------------

    If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.

  • rwittels Profile Picture
    510 on at

    It does not work with my SendPushNotification though.

    This works:

    recipients: ["myname@mycompany.co.za"],

    This does not work:

    recipients: [varUser in varAdmins.Value],

     

    I even tried creating a single variable OnStart:

    Set(adminUser,varUser in varAdmins.Value)

    This works great on button visibility but does not work in SendPushNotification:

    recipients: [adminUser],

    It also says that the data type is boolean: adminUser = true

     

    Do you know what I am doing wrong?

  • JFbsis21 Profile Picture
    30 on at

    hope the thread is still open as I am having the same /similar issue - in my case I receive a message when trying to login to Admin -saying not a valid account or similar. This is when I click on the Login as Admin button ( I am an admin)using the Help Desk app which I am trying to customize from the Help desk sample app (canvas) in PowerApps

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 530

#2
WarrenBelz Profile Picture

WarrenBelz 459 Most Valuable Professional

#3
Haque Profile Picture

Haque 314

Last 30 days Overall leaderboard