cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Anonymous
Not applicable

Collection of office 365 Users?

Hi all,

 

I have built an app which is in production and working away nicley. The app has to have several screens that only certain managers can see. The app OnStart shows the following -
If(Mail = "user@example.com",Navigate(ManagerScreen,ScreenTransition.None), , Mail="user2@example.com", Navigate(ManagerScreen, ScreenTransition.None).....we have 20+ emails in here and i have this on most of the home icons of the shared screens too.

I am worried about there being too many emails listed and over time i expect more users to be added to this.

I was wondering if there was a way i can add these users to a collection, then i could use the collection as an If function? I cant seem to work this out so would appreciate any help or suggestions if there is a better way?

 

Thanks

Donna

1 ACCEPTED SOLUTION

Accepted Solutions
v-xida-msft
Community Support
Community Support

Hi @Anonymous ,

Do you want to check if the current sign user is an manager, if true, then navigate him/her to the Manager screen?

 

Based on the needs that you mentioned, I have made a test on my side, please take a try with the following workaround:

Set the OnStart property of the App control to following:

ClearCollect(
            ManagerEmailCollection,
            "user@example.com",
           "user2@example.com",
           "user3@example.com",
           ...
           "user20example.com",
           ...
);
If(
    User().Email in ManagerEmailCollection,       /* or type User().Email in ManagerEmailCollection.Value */
    Navigate(ManagerScreen, ScreenTransition.None)
)

Or

ClearCollect(
            ManagerEmailCollection,
            "user@example.com",
           "user2@example.com",
           "user3@example.com",
           ...
           "user20example.com",
           ...
);
If(
    Mail in ManagerEmailCollection,
    Navigate(ManagerScreen, ScreenTransition.None)
)

Please consider take a try with above solution, then check if the issue is solved.

 

In addituion, you could also consider add a data source (e.g. a SP List) to store the managers' email. You could consider type the manager email within the Title column (one record for one Manger email). Then add this SP list in your app as data source, and set the OnStart property of the App control to following:

If(
    Lower(User().Email) in Lower('YourSPList'.Title),       /* or type User().Email in ManagerEmailCollection.Value */
    Navigate(ManagerScreen, ScreenTransition.None)
)

Or

If(
    Lower(Mail) in Lower('YourSPList'.Title),       /* or type User().Email in ManagerEmailCollection.Value */
    Navigate(ManagerScreen, ScreenTransition.None)
)

then re-load your app, check if the issue is solved.

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

5 REPLIES 5
panand99
Impactful Individual
Impactful Individual

Hi,

 

You can acheive this by many ways, one of the best way is:-

 

Create a list with only one defualt column- title, having all email ids of users.

 

//tempRequest is the new list 

 

Create a text input varialbe and on that - Find(Lower(User().Email) ,Lower(tempRequest.Title),1)

 

Now, - if(Value(<your text input varialble>0),Navigate....,otherNavigation)

 

 

Anonymous
Not applicable

Thanks @panand99 but it doesnt seem to work for me.

 

I created a SharePoint list, added to data source, created text input but i have the attached errors.

@Anonymous 

Now that you've created a list with the emails listed in it, change your OnStart formula to the following:

 

If(
!IsBlank(
Lookup(L3, Lower(Title)=Lower(Mail)).Title
),
Navigate(ManagerScreen, ScreenTransition.None)
)

This assumes that you have a varible called Mail.  

Also, since you are doing this in the OnStart, make sure that your App settings are not set to allow non-blocking OnStart rules as you'll want this to occur not in parallel with other rules.

 

I hope this is helpful for you.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!
v-xida-msft
Community Support
Community Support

Hi @Anonymous ,

Do you want to check if the current sign user is an manager, if true, then navigate him/her to the Manager screen?

 

Based on the needs that you mentioned, I have made a test on my side, please take a try with the following workaround:

Set the OnStart property of the App control to following:

ClearCollect(
            ManagerEmailCollection,
            "user@example.com",
           "user2@example.com",
           "user3@example.com",
           ...
           "user20example.com",
           ...
);
If(
    User().Email in ManagerEmailCollection,       /* or type User().Email in ManagerEmailCollection.Value */
    Navigate(ManagerScreen, ScreenTransition.None)
)

Or

ClearCollect(
            ManagerEmailCollection,
            "user@example.com",
           "user2@example.com",
           "user3@example.com",
           ...
           "user20example.com",
           ...
);
If(
    Mail in ManagerEmailCollection,
    Navigate(ManagerScreen, ScreenTransition.None)
)

Please consider take a try with above solution, then check if the issue is solved.

 

In addituion, you could also consider add a data source (e.g. a SP List) to store the managers' email. You could consider type the manager email within the Title column (one record for one Manger email). Then add this SP list in your app as data source, and set the OnStart property of the App control to following:

If(
    Lower(User().Email) in Lower('YourSPList'.Title),       /* or type User().Email in ManagerEmailCollection.Value */
    Navigate(ManagerScreen, ScreenTransition.None)
)

Or

If(
    Lower(Mail) in Lower('YourSPList'.Title),       /* or type User().Email in ManagerEmailCollection.Value */
    Navigate(ManagerScreen, ScreenTransition.None)
)

then re-load your app, check if the issue is solved.

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
Not applicable

Hi all thank you so much for all your responses.

 

@v-xida-msft- i have adopted your solution and it is perfect! This has cleaned up things so much better in my app. Thank you so much! 🙂

Helpful resources

Announcements
Power Apps Africa Challenge 2022

Power Apps Africa Challenge

Your chance to join an engaging competition of Power Platform enthusiasts.

Super User 2 - 2022 Congratulations

Welcome Super Users

The Super User program for 2022 - Season 2 has kicked off!

September Events 2022

Check out all of these events

Attend in person or online, there are incredible conferences and events happening all throughout the month of September.

Government Carousel

New forum: GCC, GCCH, DoD - Federal App Makers (FAM)

In response to the unique and evolving requirements of the United States public sector, Microsoft has created Power Apps US Government.

Users online (1,827)