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

SOLVED: Filter gallery to exclude specific user in Office365 Group

Hi,

I'm working on the Leave Request App and have been customizing a lot to it and it currently works as I hope it would be except for 1 thing.

 

The initial template allows requestor to select any users in the organization as a leave approver which is not good.

I have modified this portion of code(GalleryUserSearchResultsApproverPopup in SelectApproverPopup screen) to only allow members of an Office365 group called "Leave Approvers".

 

If(!IsBlank(Trim(TextInputSearchFilter.Text)),Filter(Office365Users.SearchUser({searchTerm:Trim(TextInputSearchFilter.Text), top: 15}),Mail in Office365Groups.ListGroupMembers("ID-HERE").value.mail))

Now this works well, the search results limit to members of this group instead of everyone in the organization.

This got me thinking further on how to improve this by not allowing the requestor to set themselves as leave approver(In case these users are already member of the Leave Approver Group).

 

I have tried various ways by modifying the filter logic however weren't successful hence posting on here hoping someone can point me in the right direction.

 

Goal is to exclude 1 user from the search results = requestor(can use email, display name or whatever information that is linked to the requestor)

1 ACCEPTED SOLUTION

Accepted Solutions
Community Support Team
Community Support Team

Re: Filter gallery to exclude specific user in Office365 Group

Hi @asri_zainal,

Do you not want the requesters to set themselves as leave approver?

 

I have made a test on my side, please take a try with the following workaround:7.JPG

Set the Items property of the GalleryChangeApprover Gallery within the ChangeApproverScreen to following formula:

If(
!IsBlank(Trim(TextInputSearchUser.Text)),
Filter(
Office365Users.SearchUser({searchTerm:Trim(TextInputSearchUser.Text)}),
Mail in Office365Groups.ListGroupMembers(Dropdown1.Selected.id).value.mail,
Mail<>User().Email /* <-- Add formula here */
)
)

On your side, you should type the following formula:

If(
!IsBlank(Trim(TextInputSearchFilter.Text)),
Filter(
Office365Users.SearchUser({searchTerm:Trim(TextInputSearchFilter.Text), top: 15}),
Mail in Office365Groups.ListGroupMembers("ID-HERE").value.mail,
Mail<>User().Email /* <-- Modify here */
)
)

More details about User function in PowerApps, please check the following article:

User function

 

Best regards,

Kris

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

3 REPLIES 3
Community Support Team
Community Support Team

Re: Filter gallery to exclude specific user in Office365 Group

Hi @asri_zainal,

Do you not want the requesters to set themselves as leave approver?

 

I have made a test on my side, please take a try with the following workaround:7.JPG

Set the Items property of the GalleryChangeApprover Gallery within the ChangeApproverScreen to following formula:

If(
!IsBlank(Trim(TextInputSearchUser.Text)),
Filter(
Office365Users.SearchUser({searchTerm:Trim(TextInputSearchUser.Text)}),
Mail in Office365Groups.ListGroupMembers(Dropdown1.Selected.id).value.mail,
Mail<>User().Email /* <-- Add formula here */
)
)

On your side, you should type the following formula:

If(
!IsBlank(Trim(TextInputSearchFilter.Text)),
Filter(
Office365Users.SearchUser({searchTerm:Trim(TextInputSearchFilter.Text), top: 15}),
Mail in Office365Groups.ListGroupMembers("ID-HERE").value.mail,
Mail<>User().Email /* <-- Modify here */
)
)

More details about User function in PowerApps, please check the following article:

User function

 

Best regards,

Kris

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

asri_zainal
Level: Powered On

SOLVED: Filter gallery to exclude specific user in Office365 Group


@v-xida-msft wrote:

Hi @asri_zainal,

Do you not want the requesters to set themselves as leave approver?

 

I have made a test on my side, please take a try with the following workaround:7.JPG

Set the Items property of the GalleryChangeApprover Gallery within the ChangeApproverScreen to following formula:

If(
!IsBlank(Trim(TextInputSearchUser.Text)),
Filter(
Office365Users.SearchUser({searchTerm:Trim(TextInputSearchUser.Text)}),
Mail in Office365Groups.ListGroupMembers(Dropdown1.Selected.id).value.mail,
Mail<>User().Email /* <-- Add formula here */
)
)

On your side, you should type the following formula:

If(
!IsBlank(Trim(TextInputSearchFilter.Text)),
Filter(
Office365Users.SearchUser({searchTerm:Trim(TextInputSearchFilter.Text), top: 15}),
Mail in Office365Groups.ListGroupMembers("ID-HERE").value.mail,
Mail<>User().Email /* <-- Modify here */
)
)

More details about User function in PowerApps, please check the following article:

User function

 

Best regards,

Kris


Perfect! Can't believe it was that simple...

 

Thank you Kris - you're a star!



Community Support Team
Community Support Team

Re: SOLVED: Filter gallery to exclude specific user in Office365 Group

Hi @asri_zainal,

Have you solved your problem?

 

If you have solved your problem, please click "Accept as Solution" on the reply that contains the solution so that this thread will be marked for other users to easily identify.

 

Best regards,

Kris

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.

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: 259 members 3,383 guests
Please welcome our newest community members: