In case want to pick a value from the attribute from an array or array of objects, here’s how you can do it.
Let’s look at the below array of objects –
- Here’s sample data in a variable where there are 2 objects in an array.
And we want to retrieve the value of the attributes called as “LogicalName“
Select action in Data Operations
In order to fulfil this, let’s look at the Select action in Power Automate –
- In Data Operations, you’ll find Select operator
- When you choose Select, it’ll ask for the source of data, in this example – it’ll be the variable where we have Array of Objects.
- Now, you can choose what the resultant attribute should be called. You can enter custom name here.
In this example, I want to call it “Name of Entity“
- Now, in the Enter Value part, you must select the Logical Name attribute. So, you can use item() function to pick the value. Here’s how you use it –
- Once completed, your Select action will look something like this and you are ready to test.
- And when you run this test, here’s the result you’ll get –
You’ll pick all the values in each of the “Name of the Entity” attribute in this array.
Array vs Object
- In case you have just a single Object and not an array, you still need to use an Array.
Let’s say you choose Object type. The Flow will let you save.
- But, at runtime, it’ll throw the below error –
“The ‘from’ property value in the ‘select’ action inputs is of type ‘Object’. The value must be an array.”
So, the workaround is to store this in an Array itself and keep the type to Array.
Hope this was useful!
Here are some Power Automate posts you want to check out –
- Blocking Attachment Extensions in Dynamics 365 CRM
- Upgrade Dataverse for Teams Environment to Dataverse Environment
- Showing Sandbox or Non Production Apps in Power App mobile app
- Create a Power Apps Per User Plan Trial | Dataverse environment
- Install On-Premise Gateway from Power Automate or Power Apps | Power Platform
- Co-presence in Power Automate | Multiple users working on a Flow
- Search Rows (preview) Action in Dataverse connector in a Flow | Power Automate
- Suppress Workflow Header Information while sending back HTTP Response in a Flow | Power Automate
- Call a Flow from Canvas Power App and get back response | Power Platform\
- FetchXML Aggregation in a Flow using CDS (Current Environment) connector | Power Automate
- Parsing Outputs of a List Rows action using Parse JSON in a Flow | Common Data Service (CE) connector
- Asynchronous HTTP Response from a Flow | Power Automate
- Validate JSON Schema for HTTP Request trigger in a Flow and send Response | Power Automate
- Converting JSON to XML and XML to JSON in a Flow | Power Automate