Search code examples
odatapower-automatepowerappspowerapps-canvas

Odata filter query does not work for person field DisplayName


I have created a Power Automate flow for my Power App to export all values based on the SLT_Name. I want the users to be able to filter the records by partially entering the SLT_Owner's name. SLT_Owner is of type person. Here is how my flow looks like

ExportRows.Run("substringof('"& SLT_Owner_Filter_txt.Text &"',SLT_Owner/DisplayName)",User().Email);

This returns zero results. But it works when I say SLT_Owner/DisplayName eq '[Name]'


Solution

  • SharePoint person or group columns has Title property and not DisplayName, while working with filter queries of "Get items" action in Power Automate.

    So, try using query in this format:

    substringof('Ganesh',PersonColumn/Title)
    

    REST API example:

    <siteUrl>/_api/web/lists/getbytitle('List Name')/items?$select=Title,PersonColumn/Title&$expand=PersonColumn&$filter=substringof('Ganesh',PersonColumn/Title)
    

    Where PersonColumn is an internal name of your column in SharePoint list. You can get the internal name of your SharePoint list columns by following this article: How to find the Internal name of columns in SharePoint Online?