cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Eugene-CHN
Helper II
Helper II

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
Pstork1
Dual Super User III
Dual Super User III

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
Pstork1
Dual Super User III
Dual Super User III

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

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. 

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!

Pstork1
Dual Super User III
Dual Super User III

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.

@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

Pstork1
Dual Super User III
Dual Super User III

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
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.

Users online (3,195)