cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
dioni_25
Frequent Visitor

pva approval comments

Hello,

 

I creted a bot that requests an approval from an other user. The approver can write some comments before approving or rejecting the request. I tried to transfer approver's comments to the requester on bot's answer but I got the flow error 

The output you selected is inside a collection and needs to be looped over to be accessed. This action cannot be inside a foreach

 

Any help?

 

Thanks

 

1 ACCEPTED SOLUTION

Accepted Solutions
Expiscornovus
Super User
Super User

Hi @dioni_25,

 

The comment field is part of the responses array. Since this is the comment of the first person to respond you could use an index [0] to refer to the first response item and retrieve the comment of that response. 

 

You can use an expression like below for that:

 

outputs('Start_and_wait_for_an_approval')?['body']['responses'][0]['comments']

 

commentfield.png



Happy to help out! 🙂

Interested in more #PowerAutomate #SharePointOnline or #PowerVirtualAgents content?
Visit my blog, Subscribe to my YouTube channel or Follow me on Twitter


View solution in original post

3 REPLIES 3
Expiscornovus
Super User
Super User

Hi @dioni_25,

 

Can you share a screenshot of your flow setup? This will help with the troubleshooting.



Happy to help out! 🙂

Interested in more #PowerAutomate #SharePointOnline or #PowerVirtualAgents content?
Visit my blog, Subscribe to my YouTube channel or Follow me on Twitter


dioni_25
Frequent Visitor

Hi @Expiscornovus ,

 

 

 

rpa.jpg

 

I tried to add comments on the last step but I got the error The output you selected is inside a collection and needs to be looped over to be accessed. This action cannot be inside a foreach

Expiscornovus
Super User
Super User

Hi @dioni_25,

 

The comment field is part of the responses array. Since this is the comment of the first person to respond you could use an index [0] to refer to the first response item and retrieve the comment of that response. 

 

You can use an expression like below for that:

 

outputs('Start_and_wait_for_an_approval')?['body']['responses'][0]['comments']

 

commentfield.png



Happy to help out! 🙂

Interested in more #PowerAutomate #SharePointOnline or #PowerVirtualAgents content?
Visit my blog, Subscribe to my YouTube channel or Follow me on Twitter


Helpful resources

Announcements
Power Virtual Agents News & Announcements

Power Virtual Agents News & Announcements

Keep up to date with current events and community announcements in the Power Virtual Agents community.

Community Calls Conversations

Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

Power Virtual Agents Community Blog

Power Virtual Agents Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Users online (2,645)