web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Approvals - All must a...
Power Automate
Unanswered

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

Categories:
I have the same question (0)
  • Pstork1 Profile Picture
    68,697 Most Valuable Professional on at

    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.
  • Community Power Platform Member Profile Picture
    on at

    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

     

     

  • Community Power Platform Member Profile Picture
    on at

    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.

  • Pstork1 Profile Picture
    68,697 Most Valuable Professional on at

    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

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

  • Verified answer
    Pstork1 Profile Picture
    68,697 Most Valuable Professional on at

    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

    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.

     

     

  • Pstork1 Profile Picture
    68,697 Most Valuable Professional on at

    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.

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 522 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 364 Moderator

#3
abm abm Profile Picture

abm abm 243 Most Valuable Professional

Last 30 days Overall leaderboard