cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
rwittels
Resolver I
Resolver I

OnStart Set Collection (Array) of Admin Users

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")

 

 

 

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions

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.

View solution in original post

7 REPLIES 7
eka24
Super User
Super User

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.

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" ')?

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.

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

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.

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
Helper I
Helper I

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

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

Power Platform Call June 2022 768x460.png

Power Platform Community Call

Join us for the next call on June 15, 2022 at 8am PDT.

PA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.

PA.JPG

New Release Planning Portal (Preview)

Check out our new release planning portal, an interactive way to plan and prepare for upcoming features in Power Platform.

Top Solution Authors
Top Kudoed Authors
Users online (1,805)