Introduction

In today’s blog we will explore how to filter records in PowerApps of Dynamics 365 CRM based on the logged in user in the PowerApps.

Now I have created a default Canvas app for Account entity. As you can see in below screenshot, the list contains all the account records belonging to different users:

PowerApps Dynamics 365

Now we have to filter the records based on the logged in user in PowerApps. To achieve this please follow the below steps:

1. Create a default Canvas app for appointment entity by using Dynamics 365 CRM. You can refer our previous blog here.

2. Now, edit the “Item” property of BrowseGallery:

SortByColumns(

Filter(

Accounts,

Owner = LookUp(

Users,

‘User Name’ = User().Email,

User

)

),

“emailaddress1”,

“address1_city”,

“name”,

If(

SortDescending1,

Descending,

Ascending

)

)

Please see the screenshot below:

PowerApps Dynamics 365

The above formula filters the account records by implementing the condition if ownerid is equal to the logged in user by using the function User() in PowerApps.

The User() function in PowerApps returns the information as Email, Full Name and Image about current logged in user in PowerApps.

You can refer this blog to gets more details.

3. Now log in to the other user and you will see the app contains those account records which belongs to the user:

PowerApps Dynamics 365

Conclusion

By implementing the above steps we can filter records of Dynamics 365 CRM in PowerApps based on the owner of the records.

services