Let's POWER Automate

From no-code to low-code

Menu
  • Expressions
  • Filters
  • General
  • Application specific solutions
    • Dataverse
    • Excel
    • Forms
    • Outlook
    • Planner
    • Power Apps
    • SharePoint
    • Teams
  • Triggers
  • Ready to use solutions
    • Approval Process Template
    • Task Delegation App
    • The Ultimate Power Automate expressions cheat sheet
    • Power Automate HTTP requests to SharePoint cheat sheet
    • Power Automate HTTP requests to Graph API cheat sheet
  • ABOUT ME
  • Get help with your flow
  • POWER PLATFORM SERVICES
Menu

Avoid ‘Apply to each’ after single approval response in Power Automate

Posted on December 20, 2020November 21, 2021 by Tom

“When I use the Power Automate approval action and set it to ‘Approve/Reject – First to Respond’ i still get the ‘Apply to each’ automatically created when i use the output.”

“I have a Power Automate flow that sends an approval request to a single user. When I try to use the output of the Approval (for example the comments they have added) in a subsequent step, ‘Apply to each’ container is added.”


Output of the approval task in Power Automate is always an array of responses. And like every other array in Power Automate, if you want to access the data, you must loop through it. Process each of the objects in the array, one by one, using the ‘Apply to each’ action. It doesn’t matter how many objects the array contains. It can be just one response or 10 responses, important is the returned data type, and that’s an array. But using expressions, there’re other ways to access objects in an array.

First() expression

If it’s an array with only a single object, you can use the first() expression. You input an array as the parameter and it’ll return the first object from that array. And your responses array has only a single object, the first one.

The easiest way to get the array parameter is to actually let the flow add the ‘Apply to each’. It’s the same input, you can take it from there.

Power Automate first expression
e.g. first response from 'Start and wait for an approval' action:
first(outputs('Start_and_wait_for_an_approval')?['body/responses'])

Now you have the first response, but the response is an object with multiple values. It contains all information from the response: approver name, response, comments… Therefore, you must extend the previous expression by adding the desired value.

As before, you can get the value when you use the dynamic content in the flow. It’s the part beginning with the ? that you should add.

Power Automate first expression value
e.g. display name of the approver from the first response:
first(outputs('Start_and_wait_for_an_approval')?['body/responses'])?['responder/displayName']

You’ll need the expression for each value from the response you want to use, no more dynamic contents. The difference when building approval history is shown on the screenshots below. Using dynamic content inside ‘Apply to each’:

power automate approval history dynamic content

Using first() expression to avoid ‘Apply to each’:

power automate approval history first expression

Summary

I’d say avoiding the ‘Apply to each’ action is often a cosmetic topic in Power Automate approval processes. You can use the first() expression instead, but then the response processing part of the flow will be full of expressions, making the flow harder to read and understand.

Using ‘Apply to each’ is +1 loop in the flow. Using the first() expression is -1 loop, but +X expressions. You must decide which approach makes more sense to you.


πŸš€ Master Power Automate

Join 2,000+ professionals getting actionable Power Automate tutorials, solutions, cheat sheets & tips every week.

No spam. Unsubscribe anytime.

1 thought on “Avoid ‘Apply to each’ after single approval response in Power Automate”

  1. David Adams says:
    August 18, 2024 at 2:02 pm

    This can be simplified further. The JSON response returned from the ‘Start and wait for an approval’ action is structured {body} [responses] {responder}, where properties like displayName, for example, are wrapped in the {responder} object whereas comments, for example, are properties within the [responses] array.

    To parse {responder} values: Compose first(body(‘Start_and_wait_for_an_approval’)?[‘responses’])?[‘responder’]?[‘displayName’]

    To parse [responses] values: Compose first(body(‘Start_and_wait_for_an_approval’)?[‘responses’])?[‘comments’]

    I also use concat function to create the Claims syntax using [email]: concat(‘i:0#.f|membership|’,first(body(‘Start_and_wait_for_an_approval’)?[‘responses’])?[‘responder’]?[’email’])

    You can then use the Compose outputs in any other subsequent actions without PowerAutomate automatically adding the For Each loop.

    Reply

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

πŸš€ Master Power Automate

Join 2,000+ professionals getting actionable Power Automate tutorials, solutions, cheat sheets & tips every week.

No spam. Unsubscribe anytime.

Working on an Approval process?

Use the Approval Process Template and the Task Delegation App to skip the hard part and deploy a fully functional approval solution on a SharePoint list in minutes! And then the next one, and the next one...

Approval Template Preview ✨ Learn more ✨

Turn ideas into flows with ease!

Grab the complete Power Automate Cheat Sheet Bundleβ€”everything you need to master expressions, SharePoint HTTP calls, and Graph API in Power Automate.

Cheat Sheet Bundle Preview ✨ Get the Cheat Sheets

Didn't find what you were looking for?
Need to adjust a solution to fit your needs?
Or would you just like to get an assistance from somebody with thousands of hours of experience with Power Automate?

Power Automate blogs worth visiting

Damien Bird
Dennis (Expiscornovus)
Paul Murana

©2025 Let's POWER Automate | Theme by SuperbThemes