I want to remove list items in specific statuses for specific timeframes (ex: all 'cancelled' over 30 days).
I want to be sure that using the 'delete multiple items' control does not leave orphaned workflows running.
Solved! Go to Solution.
To make sure that you do not have orphaned workflows, you can terminate the workflows for the respective item using Web service and then delete the corresponding items. You would need to query all the ID's that you want to delete and within For-Each loop, create web service action to terminate workflow and delete the item as well.
Here is the reference for batch termination that you can use: Nintex Workflow - Batch Termination Workflow - Vadim Tabakman
Thank you, this is helpful; but what if I don’t know what workflow might be running for the list item?
This web service call in the link provided appears to require the workflow name specified.
I have just taken over for someone that left, I see that they didn’t do any cleanup. Although I’ve done C# development for many years, I’m just becoming familiar with Nintex. I’ve created a workflow that can delete list items that have been abandoned in statuses for a long time, but not sure what is going on in the background.
Is there a way to detect what workflow is running against a list item? (other than opening each one up)
Can a list item have more than one workflow operating on it at one time?
To achieve this, I would suggest navigating to the NIntex Workflow Manager at the site collection level and terminating workflows from that level. You can delete the list items and then purge workflows running on that list or in that site. This removes them from the Nintex Database which means truly deleting them from the farm.
Regarding your workflow to delete items, it will remove those items and the workflow instances that were running or ran on those items, but they will still be in the database. If you want to remove those, my suggestion above will help. A list item can have more than one workflow running against it, but I will say that this way. A list item can only have one instance of a workflow running against it, so if a workflow is named Workflow 1, than only one instance of that can be running on an item at a time. You cannot start that workflow and then two days later start it again, unless it has already completed. You can however have Workflow 2 start against that item as long as the workflows are truly different.
Hope that helps
You're absolutely right, Eric.
Another solution could be to build a workflow on the list where the items to delete are. This workflow would end all running instances on the current item (with the "Terminate workflow" action configured to stop "All except current workflow") and could maybe also delete the current item. Then in your other workflow, you could call the previous workflow for each item to delete instead of deleting them.
Hope this helps
Thanks, this is something I was considering, but I really want to create a site workflow that I can schedule.
I’m frustrated that site workflows don’t have the same options available.
My thought was using a site workflow, capture all the old items in a collection, then in a foreach loop process each one to terminate all except current, then delete the item.
- But there is no availability of the “terminate all wf’s except current” process for site wf’s
I should mention that we are still working on 2010, there is a plan to upgrade next year, but for now … however, I don’t know if this would even be an option in 2013.
It's the same in 2013 than in 2010 : in site workflows there's not the option to terminate all workflows except the current.
What you can do is :
And this should do what you'd like.
Hope this helps
Hi, David Light! Mind selecting a "correct answer" from this thread? Even if it's klunky, it's helpful to other community members seeking correct answers. Thank you!
Your community manager