cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
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

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
thirdimage

Power Automate Community User Group Member Badge

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

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

Top Kudoed Authors
Users Online
Currently online: 183 members 4,986 guests
Please welcome our newest community members: