cancel
Showing results for 
Search instead for 
Did you mean: 

Query the Nintex Database for Workflows based on state

Not applicable
18 4 6,267

You can use the following SQL query to find workflows inside the Nintex Content database based on their state. Simply modify the "WHERE" argument to look for workflows in other states.

SELECT DISTINCT i.workflowname, i.webid, i.siteid, i.listid, p.CurrentActivityTitle, p.TimeStamp

FROM dbo.workflowinstance i

  inner join WorkflowProgress P

  on I.InstanceID = P.InstanceID

WHERE i.State = '2'

Here are the different states you can query:

when 2 then 'Running'

when 4 then 'Completed'

when 8 then 'Cancelled'

when 64 then 'Error'

Cheers,

Andrew Beals

4 Comments
fslassiter
Nintex Newbie

Hi Andrew, thanks for the great post. I have had some issues with orphaned workflows. The problem is that I cannot terminate them because the list item was deleted. Thanks to your SQL explanation above and on another post I was able to track down the Workflow by instance ID in my NintexWorkflow database. I then changed the state to 8 which cancelled it.

Good work!

Not applicable

Scott,

Thanks for your comment.

It's always great to hear somebody found this information helpful! Even better to hear it helped you solve an issue you were having.

Cheers,

Andrew Beals

fslassiter
Nintex Newbie

No problem Andrew. This has been a bugger of sorts to our team for a couple of years. I am hoping that changing the state keep the timer jobs from running on those workflows also. Again, just trying to keep performance up overall. 

Thanks again You guys create an excellent product!

On Wednesday, May 3, 2017, 6:04:38 PM CDT, andrew.beals@nintex.com <community@nintex.com> wrote:

|

Nintex Community

|

Query the Nintex Database for Workflows based on state

new comment by Andrew Beals - View all comments on this blog post

Scott,

 

Thanks for your comment.

 

It's always great to hear somebody found this information helpful! Even better to hear it helped you solve an issue you were having.

 

Cheers,

Andrew Beals

Reply to this email to respond to Andrew Beals's comment.

Following Query the Nintex Database for Workflows based on state in these streams: Inbox

This email was sent by Nintex Community because you are a registered user.

You may unsubscribe instantly from Nintex Community, or adjust email frequency in your email preferences

shannis
Nintex Newbie

Thank you Andrew,

Very very helpful!!

However the result were not very good.

I have 120'000 WF running since 2014!  and 480'000 errored out! 

how can I safely

    1. Terminate workflows running on deleted items.
    2. Terminate errored workflows.
    3. Terminate those which are running since 2014 and no longer are needed. ( Jan 2014- Dec 2016 )
    4. Clean up history in Nintex DB (8M records from looping WF)

Thank you,

Sherry