cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
EMohaisen
Level: Powered On

Filter gallery items based on login user (Very Slow!!)

Hello All, @RandyHayes  

 

I am trying to filter a gallery items based on login user.

I have 2 "Person or Group" fields (Employee & Hirining Manager) from the SharePoint list.

so i would like to see all items where my name is in the hiring manager field or if my name is in the Employee field.

 

I used the following formula but it's very very slow loading the items.. any ideas please?

 

 

Filter(
'NAEOOP Master List',
Or(
'Hiring Manager'.Email = Office365Users.MyProfile().Mail,
'Employee (AD)'.Email = Office365Users.MyProfile().Mail
)
)

 

I tried as well to use the following filter but it's not working:

 

Filter(
'NAEOOP Master List',
Or(
'Hiring Manager'.Email = User().Email,
'Employee (AD)'.Email = User().Email
)
)

 

 

Note: the following will return from my Organization:

Office365Users.MyProfile().Mail => firstname.lastname@company.com

User().Email => Username@company.com

 

Thanks for your help!

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Super User
Super User

Re: Filter gallery items based on login user (Very Slow!!)

@EMohaisen 

Seems unusual that you would be seeing two different email addresses from those functions unless there are multiple aliases assigned to the user.

But at any rate...you really don't want to put those functions in a formula like that as they will slow things down.

Consider putting the correctly returning value in a variable and use that instead - this is usually done in the OnStart of the App as an easy place to do this.

   Set(MyProfileEmail, Office365Users.MyProfile().Mail)

Then in your Filter:

Filter(
    'NAEOOP Master List',
     Or(
       'Hiring Manager'.Email = MyProfileEmail,
       'Employee (AD)'.Email = MyProfileEmail
       )
)

I hope that is helpful for you.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.

View solution in original post

2 REPLIES 2
Super User
Super User

Re: Filter gallery items based on login user (Very Slow!!)

@EMohaisen 

Seems unusual that you would be seeing two different email addresses from those functions unless there are multiple aliases assigned to the user.

But at any rate...you really don't want to put those functions in a formula like that as they will slow things down.

Consider putting the correctly returning value in a variable and use that instead - this is usually done in the OnStart of the App as an easy place to do this.

   Set(MyProfileEmail, Office365Users.MyProfile().Mail)

Then in your Filter:

Filter(
    'NAEOOP Master List',
     Or(
       'Hiring Manager'.Email = MyProfileEmail,
       'Employee (AD)'.Email = MyProfileEmail
       )
)

I hope that is helpful for you.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.

View solution in original post

Highlighted
EMohaisen
Level: Powered On

Re: Filter gallery items based on login user (Very Slow!!)

@RandyHayes Thanks a LOT!! 

 

Yes, it works very well !! i really appriciate your quick help.

 

Excellent!

Helpful resources

Announcements
firstImage

Microsoft Business Applications Virtual Launch Event

Join us for an in-depth look at the new innovations across Dynamics 365 and the Microsoft Power Platform.

firstImage

Watch Sessions On Demand!

Continue your learning in our online communities.

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

FirstImage

Power Platform World Tour

Coming to a city near you

thirdimage

PowerApps Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

FourthImage

Join PowerApps User Group!!

Connect, share, and learn with your peers year-round

Top Kudoed Authors
Users Online
Currently online: 112 members 3,540 guests
Please welcome our newest community members: