cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
samrutur
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
Pstork1
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.
Pstork1
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.

Pstork1
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.
Pstork1
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.
Pstork1
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
MPA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

MSFTBizAppsLaunchEvent

Experience what’s next for Power Virtual Agents

See the latest Power Automate innovations, updates, and demos from the Microsoft Business Applications Launch Event.

New Super Users

Meet the Power Automate Super Users!

Many congratulations to the Season 1 2021 Flownaut Crew!

Power Platform ISV STudio

Power Platform ISV Studio

ISV Studio is the go-to Power Platform destination for ISV’s to monitor & manage applications post-AppSource publish.

Top Solution Authors
Users online (48,616)