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

Restrict own profile in lookup field

Hi,

I need to restrict a field in Powerapps so that the logged in user can't enter his own name as "Approver" from the Office365 user list.

 

This is from a sharepoint list 

 

Does anyone know how to do this? 

 

Thanks

Trond

2 ACCEPTED SOLUTIONS

Accepted Solutions

Please use the formulae in the Items property of your approver dropdown/Combobox.

 

Filter(Office365Users.SearchUser(),Mail <> User().Email)

If your approvers are in another field type make sure to add the formula in relevant place where you are filling the Approver values.

 

If this answers your question mark it as verified and give thumbs up

Regards,

Pavan Kumar Garlapati

View solution in original post

Hi @Anonymous 

 

Have you added Office365 Users connector as a data source in your application? For this formula to work, you need to add the connection to Office365 Users so that the functions are recognized.
 
Hope this Helps!
 
If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

View solution in original post

10 REPLIES 10

Hi @Anonymous 

 

Can you share more details about how you are displaying this field? Is this inside an edit form? You can set the "DisplayMode" property of the control as View and this won't allow user to edit it.
 
Hope this Helps!
 
If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!
Anonymous
Not applicable

Hi @yashag2255 

 

Thanks for your quick reply 🙂

 

This is inside the edit form. I can't set it as View Mode as the user needs to be able to choose any other Office365 users as "Approver" but not his/her own name. So they need to be able to choose anyone but themselves as "Approver" in that input field.

 

Regards,

Trond

Hey @Anonymous 

 

You can use below expression:
Filter(Office365Users.SearchUser(),Mail <> User().Email)
 
Hope this Helps!

If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!
Anonymous
Not applicable

Thanks @yashag2255 ,

 

Looks like this makes sense but I must be doing something wrong... 

I get an error: "Invocation of unknown or unsupported function. Location: DatacardValue34.OnSelect".

 

I also tried to enter this code in "Displaymode" but same error.

Any idea?

 

Trond

 

Please use the formulae in the Items property of your approver dropdown/Combobox.

 

Filter(Office365Users.SearchUser(),Mail <> User().Email)

If your approvers are in another field type make sure to add the formula in relevant place where you are filling the Approver values.

 

If this answers your question mark it as verified and give thumbs up

Regards,

Pavan Kumar Garlapati

Anonymous
Not applicable

Hi @PavanKumar  and @yashag2255 

 

I still have the same error :(.

In the Items property there is already filled: Choices('WBS Masterdata'.'Approver')

 

I use the DisplayFields as: ["DisplayName","Email"] and SeacrhField: ["DisplayName"]

I tried to replace Email with Displayname in Filter(Office365Users.SearchUser(),Mail <> User().Email)

 

Can you see any other issues here?

 

Frustrating.... 

Hi @Anonymous 

 

Can you try to configure the properties of the combobox as below:
 
Items: Filter(Office365Users.SearchUser(),Mail <> User().Email)
DisplayMode: EditMicrosoftTeams-image (46).png

 

Hope this Helps!
 
If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!
Anonymous
Not applicable

Hi @yashag2255 

 

I still face the same issue 😞 

error.jpg

Should'nt there be any data source in the properties in the DatacardValue?

I tried to add the data source but the Items changed to Items = 'WBS Masterdata'

 

Regards,

Trond

Hi @Anonymous 

 

Have you added Office365 Users connector as a data source in your application? For this formula to work, you need to add the connection to Office365 Users so that the functions are recognized.
 
Hope this Helps!
 
If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

Helpful resources

Announcements
Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

Community Call Conversations

Introducing the Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Top Kudoed Authors
Users online (2,304)