cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How to stop 'orphaned' workflow instance?

Dear Nintex,

I do have strange situation with a Scheduled site workflow which is still running (it still sends an email, looks like an indefinte loop) but the scheduled instance has been terminated and deleted.

I already used the NWAdmin SyncTerminatedWorkflows action. At the end this was not successful.

Unfortunately I do not have any idea how to stop this action.

How can I stop the 'orphaned' instance ?

Thanks in advance,

kind regards,

Jelle Dijkstra

Labels: (1)
0 Kudos
Reply
8 Replies
Workflow Hero

Re: How to stop 'orphaned' workflow instance?

but the scheduled instance has been terminated

have you removed workflow schedule as well?

go to Site Contents > Site Workflows and check whether are not any still running instances.

0 Kudos
Accept as Solution Reply
Not applicable

Re: How to stop 'orphaned' workflow instance?

Dear Nintex,

I have termined the instance and also removed the schedule (Even the workflow has been removed).

regards,

Jelle Dijkstra

0 Kudos
Accept as Solution Reply
Not applicable

Re: How to stop 'orphaned' workflow instance?

Jelle,

To be clear, when you ran the "SyncTerminatedWorkflows" command did you include the "terminateDeletedItems" switch in your command?

Cheers,

Andrew Beals

0 Kudos
Accept as Solution Reply
Not applicable

Re: How to stop 'orphaned' workflow instance?

Andrew,

Yes I used the switch terminateDeleteItems.

I first ran a -Prescan than a command without -Prescan and later on the instances were gone.

So to me this looks successful.

regards,

Jelle

0 Kudos
Accept as Solution Reply
Workflow Hero

Re: How to stop 'orphaned' workflow instance?

‌, did you ever find a resolution to this issue?  I'm currently having the same problem.  

0 Kudos
Accept as Solution Reply
Not applicable

Re: How to stop 'orphaned' workflow instance?

Brendan,

If you know what sharepoint content database the workflow is running on you can invoke the dbo.proc_cancelworkflow to stop a running workflow.

For example:

USE WSS_Content_SITE;
EXEC dbo.[proc_cancelworkflow]
@WorkflowInstanceId = 'D0258592-0C9E-46DB-899C-097DD64D8090',
@SiteId = '6882a96b-42e8-45fa-9522-1f9db6f68266'
GO

You can also attempt to use powershell to cancel the workflow using the in place sharepoint methods:

For example:

[Microsoft.SharePoint.Workflow.SPWorkflowManager]::CancelWorkflow($wf)

The variable "$wf" is the instance of the Microsoft.SharePoint.Workflow.SPWorkflow object (aka your workflow). You'll have to populate that variable on your own but if you're crafty you can figure it out.

Here's an example of how to find and store that object:

$web = get-spweb "<url of web>"

$list = $web.lists.trygetlist("<list name>")

$item = $list.Items.GetItemById(<ID of item in your example>)

$item.Workflows | fl InstanceId, InternalState

All of this is covered in my blog post Tracking and Resolving Stuck Workflow Timer Jobs 

Cheers,

Andrew Beals

Accept as Solution Reply
Workflow Hero

Re: How to stop 'orphaned' workflow instance?

Thanks ‌.  I'll have to get with our admins to try this.

0 Kudos
Accept as Solution Reply
Not applicable

Re: How to stop 'orphaned' workflow instance?

Hi Brendan,

I am sorry for the late reply. 

As Andrew Beals suggested already; I also used moretheless the same method (powershell, cancel workflow) to stop orphaned workflows.

First find ID of orphaned workflow.

Afterwards cancel workflow with given ID.

Regards,

Jelle Dijkstra

0 Kudos
Accept as Solution Reply