cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Vstar19
Helper V
Helper V

select action to get items from JSON

Hi All. 

 

I have a Filter Array (which is called List Products) which is returning me some data from a SPO list.  I need to be able to get every Primary Owner of every Product. (i have to use a filter array because the list has a calculated column that I cannot use in the filter query of get list items. 

 

E.g of the data returned as JSON from the List Products Filter Array: 

 

[
{
"@odata.etag":"\"37\"",
"ItemInternalId":"31",
"ID":31,
"Title":"4345GFC59D-FFDF-4EWR6-85FB-F8WQE46C7AE86",
"Name":"Test Item1",
"PrimaryOwner":{
"@odata.type":"#Microsoft.Azure.Connectors.SharePoint.SPListExpandedUser",
"Claims":"i:0#.f|membership|joe.bloggs@domain.com",
"DisplayName":"Bloggs, Joe",
"Email":"joe.bloggs@domain.com",
"Picture":"https://testsite.sharepoint.com/sites/mysite/_layouts/15/UserPhoto.aspx?Size=L&AccountName=joe.blogg...",
"Department":"loreum ipsum",
"JobTitle":"Finance Manager",

}
},
{
"@odata.etag":"\"37\"",
"ItemInternalId":"31",
"ID":31,
"Title":"44WQETQ59D-WET43F-4086-84TQGT-F8QEWRTWEQTAE86",
"Name":"Test Item2",
"PrimaryOwner":{
"@odata.type":"#Microsoft.Azure.Connectors.SharePoint.SPListExpandedUser",
"Claims":"i:0#.f|membership|john.smith@domain.com",
"DisplayName":"Smith, John",
"Email":"john.smith@domain.com",
"Picture":"https://testsite.sharepoint.com/sites/mysite/_layouts/15/UserPhoto.aspx?Size=L&AccountName=john.smit...",
"Department":"loreum ipsum",
"JobTitle":"Finance Manager",

}
},
{
"@odata.etag":"\"37\"",
"ItemInternalId":"31",
"ID":31,
"Title":"4QWRED-FFDF-4QEWR-8QWREQRB-F8BWERQREWR",
"Name":"Test Item3",
"PrimaryOwner":{
"@odata.type":"#Microsoft.Azure.Connectors.SharePoint.SPListExpandedUser",
"Claims":"i:0#.f|membership|jane.lane@domain.com",
"DisplayName":"Lane, Jane",
"Email":"Jane.Lane@domain.com",
"Picture":"https://testsite.sharepoint.com/sites/mysite/_layouts/15/UserPhoto.aspx?Size=L&AccountName=jane.lane...",
"Department":"loreum ipsum",
"JobTitle":"Finance Manager",

}
}
]

 

I created a select statement directly below this filter array as below

 

Select Action

From : Body('List Products')

Map : body('ListProducts')?[0]?['PrimaryOwner']?['Email']

 

However, the output of the select statement is

"Joe.Bloggs@domain.com"

"Joe.Bloggs@domain.com"

"Joe.Bloggs@domain.com"

 

I has correctly got 3 items, but the output should be

"Joe.Bloggs@domain"

"John.Smith@domain.com"

"Jane.Lane@domain.com

 

Can someone advise on what i am doing wrong?. I know the map i got is wrong, but what should it be so that it list every Primary Owner?

 

Thanks in Advance. 

 

1 ACCEPTED SOLUTION

Accepted Solutions
gabibalaban
Dual Super User
Dual Super User

@Vstar19 ,

Select Action

From : Body('List Products')[‘value’]

Map : item()?['PrimaryOwner']?['Email']

Hope it helps !

View solution in original post

3 REPLIES 3
gabibalaban
Dual Super User
Dual Super User

@Vstar19 ,

Select Action

From : Body('List Products')[‘value’]

Map : item()?['PrimaryOwner']?['Email']

Hope it helps !

Thank yo. 

What is the main difference between using Body('ActionName')?[value]  & item()?[value] ?

@Vstar19 ,

Body('ActionName')?[value] - refers to the entire array of objects from body property of the ActionName outputs.

The  expanded formula , actuallly the  complete one is :

outputs(‘Action_Name’)[‘body/value’],
but powerautomate let you to directly refer to the body property of the action using body(‘action_name’).

- item()[property name] is used inside operation actions as select to refer to a specific property of each object of the array of objects passed as From parameter.

 

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

New Ideas Forum MPA.jpg

A new place to submit your Ideas for Power Automate

Announcing a new way to share your feedback with the Power Automate Team.

MPA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.

MPA Licensing.jpg

Ask your licensing questions at the Power Automate AMA!

Join Priya Kodukula and the licensing team, super users and MVPs to find answers to your questions on Power Automate licensing.

Users online (1,589)