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

6 REPLIES 6
eka24
Super User III
Super User III

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.

View solution in original post

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?

Helpful resources

Announcements
PA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

Power Query PA Forum 768x460.png

Check it out!

Did you know that you can visit the Power Query Forum in Power BI and now Power Apps

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

R2 (Green) 768 x 460px.png

Microsoft Dynamics 365 & Power Platform User Professionals

DynamicsCon is a FREE, 4 half-day virtual learning experience for 11,000+ Microsoft Business Application users and professionals.

Users online (1,946)