cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Advocate IV
Advocate IV

RespondTo-FlowApprovalRequest PowerShell cmdlet

Question on the RespondTo-FlowApprovalRequest cmdlet. I am attempting to use this cmdlet to set the response of an approval request to rejected but it doesn't seem to be working.

 

I tried the Add-PowerAppsAccount cmdlet to connect as the approver who has the request and an admin with P2 license. In both cases the RespondTo-FlowApprovalRequest runs without error but the approval response does not change. Ideally we need the response to change and the Flow to move on to the next step. Is there a bug with this cmdlet or may be the usage is incorrect?

 

Thank you.

 

 

6 REPLIES 6
Dual Super User III
Dual Super User III

First, what version of the PowerShell cmdlets are you using? I just downloaded and isntalled version 1.0.7 and the cmdlet is now Approve-FlowApprovalRequest or Deny-FlowApprovalRequest.  Try the most recent version of the cmdlets and see if they don't work better.  You can get them using this command

Install-Module -Name Microsoft.PowerApps.PowerShell -AllowClobber -Force


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

I should also add that right now the cmdlets are only for use by App Makers and Admins.  I'm not sure you'll be able to get them to work with an account that didn't create the Approval.



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

Thank you. I was able to install the latest module and can see these two cmdlets. Attempted to run the deny cmdlet as the account that created the approval request but it did not work. No errors as well when running it.

Dual Super User III
Dual Super User III

Was the approval addressed to the account you tried to run the Deny with?



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

The following worked for me if the approval was assigned to me.  I haven't tried it with a different user.  I'll try that next.

Add-PowerAppsAccount

$approval = Get-FlowApprovalRequest
Deny-FlowApprovalRequest -ApprovalId $approval[0].ApprovalId -ApprovalRequestId $approval[0].ApprovalRequestId  -EnvironmentName $approval[0].EnvironmentName -Comments "Approval Denied"


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

Just tried it with a regular user and it seems to work there also if I log in as the user who needs to accept or reject the approval.  The user is a maker, but didn't make this particular Flow.



-------------------------------------------------------------------------
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
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

MPA Community Blog

Power Automate Community Blog

Check out the community blog page where you can find valuable learning material from community and product team members!

Top Solution Authors
Top Kudoed Authors
Users online (8,071)