cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Anonymous
Not applicable

Pulling DisplayName from Array List Item

I am trying to create a flow that pulls all open items in a list and emails a weekly table.  I have everything working so far, but I am unable to pull the DisplayName from the original requester and their manager.  I do not know how to pull the DisplayName from an array.  Below is the error I am seeing

 

'DisplayName' cannot be selected. Array elements can only be selected using an integer index. Please see https://aka.ms/logicexpressions for usage details.'.

 

Thank you for helping.

 

Untitled.pngUntitled1.png

1 ACCEPTED SOLUTION

Accepted Solutions

 

Hi @Anonymous ,

 

It seems that these two columns allow multiple selections.

One method to solve this problem is you could set these two columns not allow multiple selections.

Like:

97.PNG

Then you could refer to item()['ColumnName']['DisplayName'] to get the value in Select action.

 

If you don’t want to set these two columns allow multiple selections, you could refer to the following method. I will take one of the fields as an example, and you can use the same method to handle the other field.

 

  • Initialize an array variable to store the data in the table, initialize the string variable to store all the requestor names in the item.
  • When traversing the items, append the field values of the items that need to be displayed in the table to the array variables.
  • Append the requestor name contained in the current item to the string variable, and the string variable needs to be cleared at the end of each loop.

You need to add one more string variable, and then use the same method to get the Manager Name and append it to the array variable.

Image reference:

Spoiler
94.PNG95.PNG96.PNG

Please take a try.

 

Best Regards,

Community Support Team _ Barry
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

4 REPLIES 4
ScottShearer
Super User
Super User

@Anonymous 

If I understand your issue, you want to take selected columns from a SharePoint Get items action, put them in an HTML table and send via email.  If that is the case, my example below should help you.  I am using the Created by column as an example, but it is just a person or group column - works the same for any person or group column.  If you need to filter the items returned, you should be using an OData filter in the Get items action - very easy to do.

The OData filter should look something like this:

Request_x00x20_Status eq 'value 1' or Request_x0020_Status eq 'value 2'

 

Table1.jpgTable2.jpg

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

Scott
Anonymous
Not applicable

Hi Scott,

 

Thank you for the reply.

 

Yes, you are correct.  I am trying to get items from the list, put them in an HTML table and send an email.  However, I have two user columns (Requester & Manager) that I want to pull the names and put them in a table.  The created by would work for the requester, but not manager.  When I follow your example, I get a jumbled mess for an email (See Below).

 

I am not familiar with the ODATA function, but after some quick researching, I'm not certain if it is what I need.  Is there not a way I can just pull the DisplayName out of the data and have that posted in the column?  Untitled2.png

 

Hi @Anonymous ,

 

It seems that these two columns allow multiple selections.

One method to solve this problem is you could set these two columns not allow multiple selections.

Like:

97.PNG

Then you could refer to item()['ColumnName']['DisplayName'] to get the value in Select action.

 

If you don’t want to set these two columns allow multiple selections, you could refer to the following method. I will take one of the fields as an example, and you can use the same method to handle the other field.

 

  • Initialize an array variable to store the data in the table, initialize the string variable to store all the requestor names in the item.
  • When traversing the items, append the field values of the items that need to be displayed in the table to the array variables.
  • Append the requestor name contained in the current item to the string variable, and the string variable needs to be cleared at the end of each loop.

You need to add one more string variable, and then use the same method to get the Manager Name and append it to the array variable.

Image reference:

Spoiler
94.PNG95.PNG96.PNG

Please take a try.

 

Best Regards,

Community Support Team _ Barry
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
Not applicable

Thank you @v-bacao-msft that worked!

Helpful resources

Announcements
Power Automate News & Announcements

Power Automate News & Announcements

Keep up to date with current events and community announcements in the Power Automate community.

Community Calls Conversations

Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

Power Automate Community Blog

Power Automate Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Users online (2,103)