Search code examples
sharepointfilteringpowerapps

Filter a list using User().FullName?


I'm new to PowerApps and I'm currently working on a basic app that lets employees edit their own record from a SharePoint list which is only populated by a few managers. PowerApps has already generated a basic CRUD application providing me with a BrowseScreen, DetailScreen and an EditScreen.

The issue I'm having is that I needed the gallery to show only the current user's records. I tried using

SortByColumns(Filter('Employee List', StartsWith(ComplianceAssetId, User().FullName)), "ComplianceAssetId", If(SortDescending1, Descending, Ascending))

But it doesn't seem to work due to "delegation issues" which I am not familiar with. I found a possible solution here but from how I understand it, it's checking for Author.Name which is not my case as the list is only populated by managers. I have a field in the list called 'Full Name'.

Any form of assistance is appreciated!


Solution

  • I suspect that the delegation issue is because of the use of the User() function in the filter argument. I suggest you replace with a variable as suggested here: Cache current user This will also improve app performance. Then your filter expression should be this:

    SortByColumns(Filter('Employee List', StartsWith(ComplianceAssetId, CurrentUser.FullName)), "ComplianceAssetId", If(SortDescending1, Descending, Ascending))