k2 blackpearl delete completed process instances - revisiting

  • 19 February 2019
  • 7 replies
  • 165 views

there are a couple of posts on this but it remains unclear what is *the* answer for this problem

 

e.g.

https://community.k2.com/t5/K2-Blackpearl-Forum-Posts/Deleting-completed-Process-Instances/td-p/103895

https://community.k2.com/t5/K2-Blackpearl-Forum-Posts/Deleting-Completed-Process-Instances/m-p/78256

 

 

my question is simply, does k2 currently have an official supported method to delete process instances that have already been completed?

 

from k2 management we can locate and delete process instances that are active, but not those which are completed.

I understand that there are some methods as the ones stated in the link above but I wouldn't want to mess around with changes to the database

 

I guess one way is opening a ticket and ask that support does it themselves (?) on a case-by-case basis, but I was hopeful that something has been made available in the API or something else that can be used to accomplish this.

 

thanks.


7 replies

Hi mcawesomept

 

The short anser would be no it's currently not possible to delete a completed process instances, these completed instances are logged to the K2ServerLog db table for historical/reporting purposes and you cannot delete them individually.

It would be recommened to log a support ticket and have a support engineer assist you in having these process instances removed if you wish.

 

A feature request was logged for this which you can place a vote for:
https://ideas.k2.com/ideas/APIT-I-896

 

-Sello

Userlevel 3
Badge +9

Hi,

 

This is not exactly what you are looking for, but might help.

 

K2 workflow instances bloats the database over the period of time and at some point you would want to delete the old workflow instance which are completed or in error status.

 

Unfortunately, there is no way to delete specific instances of workflow, in other words, you could not select specific instance and delete it.

However, you can delete then in a bulk.

 

For instance, you would want to delete old workflow instances, which are completed and occupying the significant space in database, Instances on which you are not giong to report in future or you just want to delete them as a part of clean up activity.

 

You can follow below steps to do so.

  1. If you have 4.7 vision installed you can go to management workspace. For older version, you can follow similar steps
  2. Expand workflow server node.
  3. Go to your category to find workflow for which you want to delete workflow instances.
  4. Click on versions.
  5. Select version you want to delete.
  6. Check “Delete all historical (log) data for selected versions”

 

Badge +13

If I recall it does not allow delete process version if there are active instances.

The code is there in the archive script (which deletes from various of tables).

Out of box it just archives all processes based on date and not specific process or instance.

K2 could easily modify that script to ad more filter.   I have been waiting for this for 10 years.

 

Hi,

We had the same issue with the k2 instance we have earlier . As we dont want to execute the scripts in K2 DB we are using the k2 archive feature.

We have K2 API already available for doing this. if you want to have the powershell version of the same. Refer the attached text file.

 

FYI.. this archival will move the instances(both active and completed) to a different DB.

Badge +9

Hi

 

There is stored procedure called serverlog.sogetprocessinstances. If you pass the full processname to this sp it will get you a list of processinstanceid's. Now just do a while loop and execute the serverlog.lprocinstremove method for each processinstanceid that is returned.

 

If this article is helpful please dont forget to mark it as KUDOS and solution or KUDOS only

 

K2 will not accept any liability for any issues arising from actions taken in respect of the information provided by any forum

 

Regards

Elvis

 

 

Userlevel 2

Hi  @mcawesomept,

 

Completed process instances are logged to the K2ServerLog database for historical and reporting purposes, unfortunately there is no user friendly way to delete the individual completed process instances.

It is however possible to delete a specific version of a process definition and all of the historical data for that version of
the process definition using Workspace. However, please note that this will delete all process instances associated with the version of the process definition that is deleted, including Active instances etc.
That said, I suggested you take a look at this functionality in the development environment before using it in production.

 

I hope this answers your question, should you find the above information useful to your problem please Mark as "Accepted Solution and/ Kudo"

 

Thank you.

 

K2 will not accept any liability for any issues arising from actions taken in respect of the information provided by any forum member

Good day mcawesomept

 

I understand your frustration. Sadly there is no clear and concrete answer to this problem. I do however have a suggestion that can solve your problem. See the steps listed below:

 

1. Navigate to management.

2. Expand the workflow server category

3. Click on the workflows category.

4. Click on the instances tab and now you should see your instances.

 

I sincerely hope this reply will answer your question.

 

If this post helped you to solve your problem and answer your question, Please remember to mark it as a Kudo/Solution.

 

Kind Regards

Jacques

 

[K2 will not accept any liability for any issues arising from actions taken in respect of the information provided by any forum member]

Reply