Get the Current User in Power Apps
The User() function gets you started, but most real scenarios need more. Here's how to get the current user's details from Dataverse, including Business Unit, Team membership, and security role.
Almost every canvas app needs to know who’s using it. Personalized views, record ownership, conditional visibility based on role — it all starts with identifying the current user.
The User() Function
The quickest way to get user info:
User().Email // "john.smith@contoso.com"
User().FullName // "John Smith"
User().Image // Profile photo (can be used in an Image control)
You can use these directly in labels, filters, or anywhere you need them. No setup required.
Getting the User’s Dataverse System User Record
User() gives you three properties. If you need anything else — the user’s Business Unit, their Teams, their GUID, their job title — you need to look them up in the Users (systemuser) table in Dataverse.
On your App.OnStart or App.Formulas:
// App.OnStart approach
Set(
varCurrentUser,
LookUp(
Users,
'Primary Email' = User().Email
)
)
Or with the newer App.Formulas (no loading delay):
// App.Formulas approach
varCurrentUser = LookUp(Users, 'Primary Email' = User().Email);
Now you have access to everything on the system user record:
varCurrentUser.'Full Name'
varCurrentUser.User // The GUID
varCurrentUser.'Business Unit' // Lookup to Business Unit table
varCurrentUser.Title
Getting the User’s Business Unit Name
Since 'Business Unit' is a lookup column, you can access its display name directly:
varCurrentUser.'Business Unit'.'Business Unit'
Or look it up explicitly if you need more fields:
Set(
varBusinessUnit,
LookUp(
'Business Units',
'Business Unit' = varCurrentUser.'Business Unit'.'Business Unit'
)
)
Checking Team Membership
To check if the current user belongs to a specific team:
Set(
varIsApprover,
CountRows(
Filter(
'Team Memberships',
User = varCurrentUser.User,
'Team Name' = "Approvers"
)
) > 0
)
You can use this to show or hide buttons, sections, or entire screens based on team membership.
Checking Security Roles
There’s no direct way to check security roles from a canvas app formula. The security role assignment tables aren’t easily queryable from Power Fx. The two practical approaches:
Option 1: Use a Dataverse security role check via Power Automate. Call a flow that runs a FetchXML query against the systemuserroles table and returns true/false.
Option 2: Use Team membership as a proxy. Assign users to Teams that mirror your security roles, and check Team membership instead (see above). This is simpler and what I recommend for most scenarios.
Common Mistakes and How to Fix Them
User().Email Doesn’t Match the Dataverse Record
The email from User() comes from Azure AD (Entra ID). The 'Primary Email' on the system user record in Dataverse is set when the user is added. If someone’s email changed in Azure AD but Dataverse wasn’t updated, they won’t match.
Fix: Use 'Azure Active Directory Object Id' instead of email for the lookup. It never changes.
Set(
varCurrentUser,
LookUp(
Users,
'Azure Active Directory Object Id' = User().EntraObjectId
)
)
User().EntraObjectId is available in modern canvas apps and is more reliable than email matching.
The Lookup Returns Blank
If varCurrentUser is blank, the user might not have a Dataverse system user record (they haven’t been added to the environment), or the email/ID doesn’t match. Check:
- Does the user have a security role in the environment?
- Is the user enabled (not disabled) in the system user table?
- Does the
'Primary Email'field actually contain their email?
Performance: Don’t Look Up the User on Every Screen
Call LookUp(Users, ...) once in App.OnStart or App.Formulas and store the result. Don’t put it in individual screen OnVisible properties — that makes a Dataverse call every time the user navigates.
Guest Users Return Different Values
If your app is shared with external (guest) users, User().Email returns their guest email format (often with #EXT# in it). The lookup against Dataverse will fail. For apps with guest users, use User().EntraObjectId as mentioned above, or handle the email format difference explicitly.
Related articles
Should You Build a PCF Control?
Power Apps Component Framework lets you build React-based custom controls for model-driven forms and views. Most of the time, you shouldn't. Here's when PCF is the right answer — and what the tooling docs don't warn you about.
Power Platform Licensing: What I Wish Someone Told Me on Day One
Licensing isn't a procurement problem — it's an architecture decision. Here's the mental model every solution architect needs before starting a Power Platform project, with real scenarios and a pre-project checklist.
Cascading Dropdowns in Canvas Apps (Yes, It's Harder Than It Should Be)
A parent dropdown for Country, a child dropdown for City that only shows cities in the selected country. Here's the pattern, the delegation-safe version, and the reset behavior that catches everyone.