1

A SPD workflow has become suspended, but I'm unable to cancel it. I'm trying to kill the workflow with the PNP command, but thats not working either, Am I missing something?

I'm using:-

Stop-PnPWorkflowInstance -identity e31bd8e7-90f3-42a3-898b-e9ebd326befc -force -verbose

The response I get in powershell is

VERBOSE: Instance object not set. Looking up site workflows by GUID: e31bd8e7-90f3-42a3-898b-e9ebd326befc

The workflow is still stuck in suspended mode, I'm unable to kill it. Any suggestions?

1
  • did you try my edited reply ?
    – Jerry
    May 27, 2019 at 7:08

2 Answers 2

2

Here is a demo to stop workflow instance using PnP PowerShell. Get a running workflow instance and then stop it:

Connect-PnPOnline -url "https://tenant.sharepoint.com/sites/dev"


Get-PnPWorkflowInstance -List "DateTest" -ListItem 2 | Where-Object {($_.Id -eq "21870821-2e70-4c29-bca9-b07eef8e53b5")} |
        Foreach-Object {
            Stop-PnPWorkflowInstance -Identity $_ -Verbose -Force 
        }

The Id in the code snippet above can be found in the workflow url:

enter image description here

enter image description here

3
  • I get this error message:- Stop-PnPWorkflowInstance : Cannot convert 'System.Object[]' to the type 'SharePointPnP.PowerShell.Commands.Base.PipeBinds.WorkflowInstancePipeBind' required by parameter 'Identity'. Specified method is not supported. At line:1 char:36 + Stop-PnPWorkflowInstance -identity $wfinstance + ~~~~~~~~~~~ + CategoryInfo : InvalidArgument: (:) [Stop-PnPWorkflowInstance], ParameterBindingException + FullyQualifiedErrorId : CannotConvertArgument,SharePointPnP.PowerShell.Commands.Workflows.StopWorkflowInstance
    – Akashic
    May 23, 2019 at 5:37
  • This could be because the Get-PNPWorkflowInstance returns multiple workflows that have already completed as well as the workflow that is suspended
    – Akashic
    May 23, 2019 at 5:59
  • @Akashic, If you have multiple started workflows in specific item, please use Foreach-Object to loop and get the specific workflow instance with Id
    – Jerry
    May 23, 2019 at 9:20
0

The Stop-PnPWorkflowInstance accepts -identity param as the workflow instance object. You can use Get-PnPWorkflowInstance command to get the instance and supply it to the stop workflow command.

1
  • Can you provide an example, this is just info from the documentation.
    – Akashic
    May 23, 2019 at 5:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.