Skip to main content
Community site session details

Community site session details

Session Id :
Power Automate - Building Flows
Answered

How to get DisplayName from filter array (multiperson field)

(0) ShareShare
ReportReport
Posted on by 104

Due to earlier complications in my flow I use filter array (Get items with OData filter not suitable), but in using this I am not sure how to extract DisplayName from a multiperson field.

 

I have tried various variations along the lines of below but can't seem to get it to work;

item()?['SiteContacts']?['DisplayName']

 

All the other fields behave as expected, and if I use item()?['SiteContacts'], I get the correct info, but just with all the person details (claims, email etc), I just want the display names though.

 

Any help gratefully received.

 

tatmaninov_0-1671395260837.png

 

 

  • Jayaprakash Profile Picture
    35 on at
    Re: How to get DisplayName from filter array (multiperson field)

    I come up with same issue it's working fine with the @Amit_Sharma solution. Thank you

  • tatmaninov Profile Picture
    104 on at
    Re: How to get DisplayName from filter array (multiperson field)

    Hi @grantjenkins , Yes, after Select I create HTML table, apply CSS Style and place in an email with some text including some other variables and send to colleagues.

  • grantjenkins Profile Picture
    11,059 Super User 2025 Season 1 on at
    Re: How to get DisplayName from filter array (multiperson field)

    @tatmaninov Just wondering what you are including in the email you send out to each of the users. Are you using the Select to build up an HTML table?

  • tatmaninov Profile Picture
    104 on at
    Re: How to get DisplayName from filter array (multiperson field)

    Thanks @Amit_Sharma I have now managed to solve it with your help and the input from @grantjenkins .

     

    It still confuses me a little that the XML refers to the earlier Get Items, but seems to work.

     

    I had to change the Select (for the table columns) to an Array variable inside the For each, but like I say, now working.  Thanks you.

    tatmaninov_0-1671456361297.png

     

  • Verified answer
    Amit_Sharma Profile Picture
    1,569 Super User 2024 Season 1 on at
    Re: How to get DisplayName from filter array (multiperson field)

    Hi @tatmaninov,

    Please modify your existing flow as shown below.

    Amit_Sharma_1-1671454058671.png

     

    xml(json(concat('{"root": { value:', outputs('Get_items')?['body/value'], '}}')))

     

    Amit_Sharma_2-1671454117034.png

     

    Amit_Sharma_3-1671454155941.png

     

    join(xpath(outputs('XML'), concat('//value[ID=', items('Apply_to_each')?['ID'], ']/SiteContacts/DisplayName/text()')), ', ')

     

    Amit_Sharma_4-1671454404610.png

     

    Please enter same name of apply to each in both place.

     

    Amit_Sharma_5-1671454471636.png

     

    Best Regards,

  • tatmaninov Profile Picture
    104 on at
    Re: How to get DisplayName from filter array (multiperson field)

    Thanks @Amit_Sharma  and @grantjenkins for taking the time to reply.  Unfortunately I don't think either solution will work as I notice you both use outputs from Get Items.  Let me explain more the 'complication' I refer to in my original post and why (I think) this forces me to use filter array instead of Get Items.

     

    The earlier steps in my flow do the following;

    Get Items filtered by a particular month (user input when flow is triggered)

    Then the flow uses a union to identify all the unique person combinations from 'EscalatedTo' field.  This is a multi-person field, some items have 1 person, some have 2, some have 3 etc.

    The EscalatedTo basically sets who the email will be sent to (1 email per EscalatedTo combination, I say combination because if one colleague is mentioned against an item by themselves and also mentioned against another item with another colleague, then they will actually receive 2 emails), within each of those emails there will be various SiteContacts.

     

    Simplified example of each email (each email may have different number of rows)

    Email to: EscalatedTo
      
    Email table
    Table RowSiteContact
    1John Smith, Bill Jones
    2David Adams
    3Rachel Smith

     

    As the union may identify one item with multiple Persons, I could not figure out to reflect that in the Get Items OData filter (I know I could use 'and' statement, but as the number of persons is variable, I found using Filter Array as the way to go.  From the Filter Array I then struggle to extract the display name.

    tatmaninov_0-1671450852016.png

     

  • grantjenkins Profile Picture
    11,059 Super User 2025 Season 1 on at
    Re: How to get DisplayName from filter array (multiperson field)

    I would use XML and XPath here to extract out the Display Names and join them.

     

    The SharePoint List I'm using for this example is below. We will extract out the Title, Status (single-select), and Members (multi-select).

    grantjenkins_1-1671419956228.png

     

    See full flow below. I'll go into each of the actions.

    grantjenkins_0-1671419890028.png

     

    Get items retrieves all the values from my List.

    grantjenkins_2-1671420009271.png

     

    XML is a Compose that converts your Get items data to XML so we can use XPath expressions to extract out the Display Names. The expression used is below. Note that it also adds a root element to ensure it's valid XML.

     

    xml(json(concat('{"root": { value:', outputs('Get_items')?['body/value'], '}}')))

     

    grantjenkins_3-1671420087685.png

     

    Select takes in the value from Get items and uses the Title and Status Value to get the single items. It then uses the following expression to extract out the full list of Display Names, then joins then, separated by ", ". Note that you would just need to use the name of your Person field (SiteContacts) in place of my Members field.

     

    join(xpath(outputs('XML'), concat('//value[ID=', item()?['ID'], ']/Members/DisplayName/text()')), ', ')
    
    //Your expression would likely look like this
    join(xpath(outputs('XML'), concat('//value[ID=', item()?['ID'], ']/SiteContacts/DisplayName/text()')), ', ')

     

    grantjenkins_4-1671420212646.png

     

    The final output in this example would be:

    grantjenkins_5-1671420292521.png

     

    [
     {
     "Name": "Team 01",
     "Status": "Yes",
     "Members": "Adele Vance, Lee Gu, Megan Bowen"
     },
     {
     "Name": "Team 02",
     "Status": "Yes",
     "Members": "Diego Siciliani, Patti Fernandez"
     },
     {
     "Name": "Team 03",
     "Status": "Yes",
     "Members": "Adele Vance, Patti Fernandez"
     },
     {
     "Name": "Test 04",
     "Status": "Yes",
     "Members": "Joni Sherman, Johanna Lorenz"
     },
     {
     "Name": "Test 05",
     "Status": "No",
     "Members": "Johanna Lorenz, Joni Sherman"
     },
     {
     "Name": "Test 06",
     "Status": "Yes",
     "Members": "Johanna Lorenz, Diego Siciliani"
     }
    ]

     

     

     

  • Amit_Sharma Profile Picture
    1,569 Super User 2024 Season 1 on at
    Re: How to get DisplayName from filter array (multiperson field)

    Hi @tatmaninov,

    I have created sample for you.

    1. use one Initialize variable Outside the apply to each Action.

    Amit_Sharma_0-1671396910725.png

     

    2. Inside the first Apply to each Action use one more Apply to each Action and pass value.

    Amit_Sharma_2-1671397158675.png

     

    3. After that Use Append to string variable Action and pass value and blank space mark blue.

    Amit_Sharma_3-1671397308635.png

    Amit_Sharma_4-1671397382145.png

     

    4. Then you can use this in your select action value.

    Amit_Sharma_5-1671397458540.png

     

    5. At the last Please use set variable action and pass value blank space mark as blue which refresh you variable.

    Amit_Sharma_0-1671397608963.png

     

    complete flow

    Amit_Sharma_1-1671397742130.png

     

  • Amit_Sharma Profile Picture
    1,569 Super User 2024 Season 1 on at
    Re: How to get DisplayName from filter array (multiperson field)

    Hi @tatmaninov,

    The Multi Person field Return array So you have to provide index value or iterate on this filed for getting all the person.

    This Would be work for only first person in your select Action.

    item()?['SiteContacts']?[0]?['DisplayName']

     

    -------------------------------------------------------------------------
    If I have answered your question, please mark your post as Solved.
    If you like my response, please give it a Thumbs Up.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Paul Stork – Community Spotlight

We are honored to recognize Paul Stork as our July 2025 Community…

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 497 Super User 2025 Season 1

#2
David_MA Profile Picture

David_MA 436 Super User 2025 Season 1

#3
Riyaz_riz11 Profile Picture

Riyaz_riz11 244 Super User 2025 Season 1