Power Automate Body/Value Expression
In Power Automate, the expression
(or equivalently outputs('List_rows_1')?['body/value'])
is used to extract the data rows returned by a "List rows" action from Dataverse, SharePoint, or another connector that returns a list of items.
Let’s break it down π
π Explanation of Each Part
| Part | Meaning |
|---|---|
outputs('List_rows_1') | Refers to the entire output (JSON) of the action named List_rows_1. The action name can differ (e.g., List_rows, List_records, etc.) |
? | Safe navigation operator — prevents errors if that property doesn’t exist. |
['body/value'] | Accesses the array of records in the response body — i.e., all the rows returned by the List Rows action. |
π§© Example
Suppose your List rows action (List_rows_1) retrieves contact records from Dataverse.
The raw output might look like this (simplified):
Then this expression:
returns:
That’s an array of objects — one per row retrieved.
π§ Common Use Cases
-
In an “Apply to each” loop:
→ This loops over every record returned.
-
To get a specific field from the first row:
π§© Example Setup
Let’s say your List rows action (List_rows_1) retrieves records from a Dataverse table (like Contacts), and its output looks like this:
Now, here’s how you can extract values from it π
π― 1. Get All Rows (Array)
To get all rows:
This returns an array of records (like above).
π― 2. Get the First Row
To get only the first record:
This returns:
π― 3. Get a Specific Column Value
To extract a specific field from that first record:
| Field You Want | Expression |
|---|---|
| Full Name | first(outputs('List_rows_1')?['body/value'])?['fullname'] |
first(outputs('List_rows_1')?['body/value'])?['emailaddress1'] | |
| Contact ID | first(outputs('List_rows_1')?['body/value'])?['contactid'] |
π― 4. Get a Field from a Specific Record in a Loop
If you use an Apply to each action:
Inside the loop, you can access each field using:
| Field | Expression inside the loop |
|---|---|
| Full Name | items('Apply_to_each')?['fullname'] |
items('Apply_to_each')?['emailaddress1'] | |
| Contact ID | items('Apply_to_each')?['contactid'] |
⚡ Quick Tip
If you renamed your loop, replace 'Apply_to_each' with the actual loop name — for example:
Would you like me to show how to filter or pick a specific row (for example, the one where email = "john@contoso.com")?
Comments
Post a Comment