cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Helper III
Helper III

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
Highlighted
Responsive Resident
Responsive Resident

Re: Restrict own profile in lookup field

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

Highlighted
Dual Super User III
Dual Super User III

Re: Restrict own profile in lookup field

Hi @TroGun18 

 

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
Highlighted
Dual Super User III
Dual Super User III

Re: Restrict own profile in lookup field

Hi @TroGun18 

 

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!
Highlighted
Helper III
Helper III

Re: Restrict own profile in lookup field

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

Highlighted
Dual Super User III
Dual Super User III

Re: Restrict own profile in lookup field

Hey @TroGun18 

 

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!
Highlighted
Helper III
Helper III

Re: Restrict own profile in lookup field

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

 

Highlighted
Responsive Resident
Responsive Resident

Re: Restrict own profile in lookup field

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

Highlighted
Helper III
Helper III

Re: Restrict own profile in lookup field

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.... 

Highlighted
Dual Super User III
Dual Super User III

Re: Restrict own profile in lookup field

Hi @TroGun18 

 

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!
Highlighted
Helper III
Helper III

Re: Restrict own profile in lookup field

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

Highlighted
Dual Super User III
Dual Super User III

Re: Restrict own profile in lookup field

Hi @TroGun18 

 

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

Helpful resources

Announcements
Ignite

Microsoft Ignite

This will be a conference that you do not want to miss!

secondImage

New Return to Workplace

Reopen responsibly, monitor intelligently, and protect continuously with solutions for a safer work environment.

August 2020 CYST Challenge

Check out the winners of the recent 'Can You Solve These?' community challenge!

Experience what’s next for Power Apps

Join us for an in-depth look at the new Power Apps features and capabilities at the free Microsoft Business Applications Launch Event.

Check this Out

Helpful information

Featuring samples like Return to the Workplace and Emergency Response Applications

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (3,413)