In K2, your development environment can become very cluttered, very quickly. I searched for a tool to be able to clear down all of the process instance data for processes that were still running and the archive/log data for processes that have completed to give me a clear, pristine and virginal K2 workspace ready to muck up again with more work in progress processes :)
That tool didn’t exist, so I wrote my own (and it was surprisingly simple!). Here are the key components.
First of all, to clear all currently running, active or errored process instances;
And secondly, the log data – this comes from a separate database which needs to be archived out.
CreateSqlTempDb and DropSqlTempDb simply create and drop an empty database in SQL, which the archive tool then moves the data to. The ArchiveConnectionString is a standard connection string to the archive db you create.
Obviously you don’t want to be running this on ANY production environments!!!!