The User Function in PowerApps
PowerApps is an incredibly robust tool that allows developers to build a custom front end interface on top of any data source. One of the most powerful aspects of the tooling is a function called “User” that can give the developer options to personalize the UI based on a logged in user, in addition to many other use cases.
Examples of the User Function in PowerApps
The User function itself returns a record of the logged in user with all of the metadata from the logged in account.
User().Email User().FullName User().Image
This function can be applied in many different ways but one of the most common ones is in the visibility property of a control in PowerApps. For example, if there was a button that should only be visible to certain users the equation would be:
That button would only be visible to someone who logged into the PowerApp and their email matched firstname.lastname@example.org. The image below is sourced from Microsoft.com and explains the commonly used properties of the User function.
There is some nuance as to where this information comes from so if this function doesn’t work, developers can also try calling the Office365Users connector and using the MyProfileV2 function. For example:
Summary and Use Cases
The user function in PowerApps can be used to create a personalized user experience based on the logged in user. An element of personalization is something that pretty much everyone is looking for and can benefit from. Users enjoy seeing targeted information and managers know that each user is only seeing their personal information.
This approach is also an easy way to include an administrator page within an application. Just add a button to the homepage of a PowerApp that is restricted to certain users, voilà, instant admin page!