cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Helper I
Helper I

How to use Approval Comments w\out Apply for each

Hi guys, 

 

A would like to create Approval Process(Wait for one response), so when i add Start and Wait approval Step, then use, for example, comments, my flow automatically add apply for each Response. How to build process with comments without this Apply for each?

 

In the Past i created another Approval Process and now I'm using them without any problems.

 

Thanks a lot

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Dual Super User
Dual Super User

Re: How to use Approval Comments w\out Apply for each

The problem is that the Approval action returns the responses in a collection, even if there is only one response.  That's why you get an apply to each.  If you are only sending out the approval to one person then you can manually code the values you are using from the response in JSON using the First() function. That will give you the First reply, comment, or whatever you specify. It works, but it requires inputting the raw json in the formula bar so its not easy for average people.  You can also key of the Outcome object, which returns the overall status, but then you won't have access to any of the comments etc.



-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

View solution in original post

6 REPLIES 6
Highlighted
Dual Super User
Dual Super User

Re: How to use Approval Comments w\out Apply for each

The problem is that the Approval action returns the responses in a collection, even if there is only one response.  That's why you get an apply to each.  If you are only sending out the approval to one person then you can manually code the values you are using from the response in JSON using the First() function. That will give you the First reply, comment, or whatever you specify. It works, but it requires inputting the raw json in the formula bar so its not easy for average people.  You can also key of the Outcome object, which returns the overall status, but then you won't have access to any of the comments etc.



-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

View solution in original post

Highlighted
Helper I
Helper I

Re: How to use Approval Comments w\out Apply for each

Ok, I got it, 

 

I have initialized variable for every comment. But its don't good when i need to develop big process, it needs to create a lot of variables. 

Highlighted
Helper II
Helper II

Re: How to use Approval Comments w\out Apply for each

What if there are 3 levels of approvals? I was able to update a spreadsheet row with the comments from the 1st approver, but when i try to do so with the 2nd, it always gives me the comments of all approvers (array) ("Responses") instead of being able to choose the same "Response".

 

How can i get the 2nd level approvers comments without having to use apply each?

 

Approver 1:

 

Capture.PNG

Approver 2:

Capture2.PNG

 

I want approver 1 and their comments, and then approver 2 and his comments only.

 

Thanks for your help!

Highlighted
Dual Super User
Dual Super User

Re: How to use Approval Comments w\out Apply for each

If you know how many approvers you have when you are writing the Flow then you can access the Responses Array using an index in JSON.  I don't have a specific example in front of me, but it would be something like this.

body('Responses')?['value'][integer]?['Comments']


-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.
Highlighted
Helper II
Helper II

Re: How to use Approval Comments w\out Apply for each

@pstork1

How do i know which row in the array i am pulling?

And when i used this formula in the expression i was told the expression is invalid.

Which value would include the # of approvers or the # of approver's comments i want to grab?

 

Thank you

Highlighted
Dual Super User
Dual Super User

Re: How to use Approval Comments w\out Apply for each

The number of approvers is based on what you submitted to the approval.  If you used an array then its the length of the array.  If you used a semicolon delimited list you either need to know or need to Split() the list on semicolons and then do the length of the array.

 

Whatever index you use will return either the comments, the approver's name, etc. depending on which field you ask for.

 

In terms of the syntax, its close, its not exact since I didn't have an example in front of me.  I'll try to pull up an old copy and put the syntax example here.  But any example is going  to be dependent on the names and actions I used.  Yours may differ.  The syntax is correct, but may not match the name.



-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

Helpful resources

Announcements
firstImage

Now Live: Power Virtual Agents Community!

We are excited to announce the launch of Power Virtual Agents Community. Check it out now!

firstImage

New & Improved Power Automate Community Cookbook

We've updated and improved the layout and uploading format of the Power Automate Cookbook!

thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

Users online (9,361)