Power Community

Power Community

How To get Dataverse User record for current logged in user

image

The User() function within Power Apps  returns a record about the current user but that information is not currently connected to the systemuser table within Dataverse instance of the environment.  User() Function returns email, fullname, image and since around Sep 2023, it is also returning Azure Entra ID of the current logged in user.

For many situations, it is necessary to obtain current user record from the systemuser table within Dataverse. One of the ways to get is by using email as a lookup field:

LookUp(Users, 'Primary Email'=User().Email)

This would work for most of the organization, however this ‘Primary Email’ also known as internalemailaddress is available for update (IsValidForUpdate =true) thus creating a risk of accidental updates and hence the above LookUp not performing as expected. Similarly, for many large organizations, there is possibility that users have subdomains in their User().Email or under internalemailaddress, and they may not match each other.

A much more robust way to handle all possible such situations is to use Entra ID of the current logged in user as below:

LookUp(Users,'Azure AD Object ID' = User().EntraObjectId)

This way any accidental changes or presence of subdomains will not alter the output of the LookUp formula.

This post was originally published on this site

- Advertisement -spot_img

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisement - Advertisement

Latest News

Unpacking the VMware Rapid Migration Plan

Allie Wolf Allie is the Marketing Manager at Dynamic Consultants Group. She graduated from Northwest Missouri State University with...

More Articles Like This

- Advertisement -spot_img