cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
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
Highlighted
Dual Super User II
Dual Super User II

Re: RespondTo-FlowApprovalRequest PowerShell cmdlet

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.
Highlighted
Dual Super User II
Dual Super User II

Re: RespondTo-FlowApprovalRequest PowerShell cmdlet

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.
Highlighted
Advocate IV
Advocate IV

Re: RespondTo-FlowApprovalRequest PowerShell cmdlet

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.

Highlighted
Dual Super User II
Dual Super User II

Re: RespondTo-FlowApprovalRequest PowerShell cmdlet

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.
Highlighted
Dual Super User II
Dual Super User II

Re: RespondTo-FlowApprovalRequest PowerShell cmdlet

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.
Highlighted
Dual Super User II
Dual Super User II

Re: RespondTo-FlowApprovalRequest PowerShell cmdlet

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
firstImage

Super User Program Update

Three Super User rank tiers have been launched!

firstImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

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!

Top Solution Authors
Top Kudoed Authors
Users online (6,560)