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

Hide a Dropdown value for the current logged in user but visible to the manager

How to hide a Drop down value if the logged in user is not the manager
 

Hello,

 

I have an approval status Choice field and I would like to Hide one of the options in the dropdown if the logged in user is not the manager of the person who created the item.

 

Is this possible in power apps?

 

please advise,

1 ACCEPTED SOLUTION

Accepted Solutions
TimRohr
Level 10

Re: Hide a Dropdown value for the current logged in user but visible to the manager

Yes, it is very possible... in lots of different ways.

 

For instance, if you have a list of options for the DropDown Items:

["1","2","3"]

You could change that list based on a condition with an If() statement:

If ( ...managerial test...,       // test if the user is the manager of the item creator
    ["1","2","3"],                // true case - the user is the manager, so show a specific entry
    ["1","3"]                     // false case - not the manager, so the item is left off
)

I've seen someone suggest in another thread you started to have a particular manager's email hardcoded into the app. It sounds like you need more flexibility than that, however. It sounds like you have lots of different people who might submit one of these forms and lots of different managers who, in relation to a subordinate, will need to do the approving. In this case, I would suggest a more robust test of managerial status (either with the Office365 connector or a table you can pull from another datasource)... but I'll leave it to you to post back if you can't determine the manager for a particular user who submitted an item.

 

Another option for limiting the items in a DropDown might be if you are pulling the options from a table/datasource and they have a field tagging them as "ManagerialOptions." In that case, you could put a filter in the Items property, limiting them to match the current user's status:

Filter( yourDataSource,
    ManagerialStatus = (
        User().Email = LookUp( yourUserDataSource,UserID = ThisItem.UserID,ManagerEmail )
    )
)

That would perform a LookUp against your User data source, and return a boolean true/false if the current user's email matched the listed managerial email for the user who opened/submitted the item. Options for the dropdown that were marked "true" for the field "ManagerialStatus" would only display if the boolean returned as "true."

 

...and there are a hundred more ways to configure this. If these don't work for your setup, post back with more information.

3 REPLIES 3
TimRohr
Level 10

Re: Hide a Dropdown value for the current logged in user but visible to the manager

Yes, it is very possible... in lots of different ways.

 

For instance, if you have a list of options for the DropDown Items:

["1","2","3"]

You could change that list based on a condition with an If() statement:

If ( ...managerial test...,       // test if the user is the manager of the item creator
    ["1","2","3"],                // true case - the user is the manager, so show a specific entry
    ["1","3"]                     // false case - not the manager, so the item is left off
)

I've seen someone suggest in another thread you started to have a particular manager's email hardcoded into the app. It sounds like you need more flexibility than that, however. It sounds like you have lots of different people who might submit one of these forms and lots of different managers who, in relation to a subordinate, will need to do the approving. In this case, I would suggest a more robust test of managerial status (either with the Office365 connector or a table you can pull from another datasource)... but I'll leave it to you to post back if you can't determine the manager for a particular user who submitted an item.

 

Another option for limiting the items in a DropDown might be if you are pulling the options from a table/datasource and they have a field tagging them as "ManagerialOptions." In that case, you could put a filter in the Items property, limiting them to match the current user's status:

Filter( yourDataSource,
    ManagerialStatus = (
        User().Email = LookUp( yourUserDataSource,UserID = ThisItem.UserID,ManagerEmail )
    )
)

That would perform a LookUp against your User data source, and return a boolean true/false if the current user's email matched the listed managerial email for the user who opened/submitted the item. Options for the dropdown that were marked "true" for the field "ManagerialStatus" would only display if the boolean returned as "true."

 

...and there are a hundred more ways to configure this. If these don't work for your setup, post back with more information.

cooltechie
Level: Powered On

Re: Hide a Dropdown value for the current logged in user but visible to the manager

Hello,

 

The drop down control in my form is a choice field in SharePoint. So what should be my formula and which property should I set this against ?

 

Please advise.

cooltechie
Level: Powered On

Re: Hide a Dropdown value for the current logged in user but visible to the manager

Thank you this worked very nicely.

Helpful resources

Announcements
firstImage

Watch Sessions On Demand!

Continue your learning in our online communities.

SecondImage

Follow PowerApps on Twitter

Stay Up-to-Date by following PowerApps on Twitter

Top Community Contributors for July 2019

Top Community Contributors for July 2019

Let's thank our top community contributors

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

FifthImage

Dynamics 365 and Power Platform April 2019 Release notes

Features releasing from April 2019 through September 2019!

Users Online
Currently online: 95 members 4,322 guests
Please welcome our newest community members: