Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Automate - Building Flows
Answered

Approvals - All must approve - Outcome field - Error due to apply to each - string v array

(0) ShareShare
ReportReport
Posted on by

I am trying to make a multi-stage approval flow. The first stage requires that all must approve. It therefore outputs an Outcome field that must be used for the condition that follows. Because the Outcome field is used in multiple places (e.g. in teams messages to the user), a "for each" card is inserted.

 

Note: This was originally inserted when I used the "responses" field, before I knew I needed to use Outcome. However on trying to create this condition from scratch it reappears when a teams message is inserted.

Flowdetail.png

 

On running, I encounter the following error:

 

 

The execution of template action 'Apply_to_each' failed: the result of the evaluation of 'foreach' expression '@outputs('Start_and_wait_for_an_approval')?['body/outcome']' is of type 'String'. The result must be a valid array.

 

 

ErrorFlow.png

 

  • Do I need to convert the Outcomes field to an array?
  • How do I do this in this circumstance?
  • Also, is the correct output to test for from Outcome "Approve" and "Reject" or should I be looking for "Approve, Approve"?
  • Why is this not required in the guidance document for this kind of approval on the MS pages?

 

Thanks

  • Pstork1 Profile Picture
    67,047 Most Valuable Professional on at
    Re: Approvals - All must approve - Outcome field - Error due to apply to each - string v array

    The other way to avoid multiple messages is to process all the responses using a Loop and append the comments to a variable.  Then use the variable to send a single message once you are out of the loop.

  • Community Power Platform Member Profile Picture
    on at
    Re: Approvals - All must approve - Outcome field - Error due to apply to each - string v array

    Okie dokie, got it working 😃 Thanks for your help.

     

    For others reading this later: I also had a teams confirmation message that included comments from the approvers, but of course that is tied to the responses fields which then creates an array and a loop, so you wind up with multiple teams messages being sent - one for each approver. The item has a field added called "Comments associated with the content approval of this item" - I am assuming that if you retrieve the updated item, you can then insert these comments into the message without creating a loop.

     

     

  • Verified answer
    Pstork1 Profile Picture
    67,047 Most Valuable Professional on at
    Re: Approvals - All must approve - Outcome field - Error due to apply to each - string v array

    Yes, it will be inserted for responses, which is a collection.  But it won't be for output.  You can use the '...' context menu on the Apply to Each to delete it.  That will of course also delete the steps inside the loop and they will need to be rebuilt after you switch it over to Outcome.  If you remove all the references to responses you should be able to drag those steps outside the apply to each before you delete it.

  • Community Power Platform Member Profile Picture
    on at
    Re: Approvals - All must approve - Outcome field - Error due to apply to each - string v array

    Apply to each was inserted automatically when I first used the "Responses" field. I am not sure how to remove it.

  • Pstork1 Profile Picture
    67,047 Most Valuable Professional on at
    Re: Approvals - All must approve - Outcome field - Error due to apply to each - string v array

    As it shows in the output of the run.  Outcome is a comma delimited string not an array.  You can't run an Apply to each loop on a comma delimited string.  You don't need the Apply to Each, just the condition.

  • Community Power Platform Member Profile Picture
    on at
    Re: Approvals - All must approve - Outcome field - Error due to apply to each - string v array

    Reading the documentation, its not clear this is behaving as Microsoft describes. The condition should not be triggering at all until the approval is completed or a rejection is submitted.

  • Community Power Platform Member Profile Picture
    on at
    Re: Approvals - All must approve - Outcome field - Error due to apply to each - string v array

    Allo,

     

    Same error. Changing the condition did stop it from spamming messages (each approved response would trigger the next step), but once all approvals are submitted it fails when deciding what to do next.

     

    The execution of template action 'Apply_to_each' failed: the result of the evaluation of 'foreach' expression '@outputs('Start_and_wait_for_an_approval')?['body/outcome']' is of type 'String'. The result must be a valid array.

     

    Output of approval field:

    ErrorDetails.PNG

     

    Condition that failed:

    ConditionFailure.PNG

     

     

  • Pstork1 Profile Picture
    67,047 Most Valuable Professional on at
    Re: Approvals - All must approve - Outcome field - Error due to apply to each - string v array

    When doing approvals, even with multiple users, the outcome field is always a single string.  Responses is a collection.  The appropriate way to filter on outcome with multiple approvers is to check whether Outcome Contains 'Reject'.  If it does then one or more approvers rejected.  If it doesn't then all approvers approved.

     

    To answer your questions

    • Do I need to convert the Outcomes field to an array? No, because its always a string and doesn't require a Loop like Responses
    • How do I do this in this circumstance? Not needed
    • Also, is the correct output to test for from Outcome "Approve" and "Reject" or should I be looking for "Approve, Approve"?  With multiple users it will be a string with each response in turn.  So check whether the string contains Reject.  Otherwise its all Approve's
    • Why is this not required in the guidance document for this kind of approval on the MS pages?  Because as I explained a loop is not necessary.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Paul Stork – Community Spotlight

We are honored to recognize Paul Stork as our July 2025 Community…

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 497 Super User 2025 Season 1

#2
David_MA Profile Picture

David_MA 436 Super User 2025 Season 1

#3
Riyaz_riz11 Profile Picture

Riyaz_riz11 244 Super User 2025 Season 1