How to delete process instances

  • 28 October 2005
  • 11 replies
  • 19 views

Badge +3
How do you delete a process instance? I went to the Instances node of my process, and deleted the desired process instances but I wasn't able to check on the Delete Log Entries so now it's still showing up on my workspace despite its "Deleted" status. I don't want those process instances to show up on my workspace anymore because I don't need them anymore. Please help.

11 replies

Badge +11
Is this in a Development environment or a Production environment?

What do you mean: "I wasn't able to check on the Delete Log Entries" ?

Regards,
Ockert
Badge +3
what i meant with "delete log entries", when you go to K2 service manager, then to your process, then on Instances, and search for the instances you want to select, then click on the X button, there is a checkbox there that says delete log entries. if you delete an instance without checking this, it will still be in your workspace but with delete status. i would've wanted (if it's possible) to not see it anymore. cos if you check on the delete log entries, you won't see it anymore in the workspace. unfortunately, one time i forgot to check that checkbox.
Badge +11
Thank you...

So you were able to select it but just forgot - at least it's not a problem in the application.

Now the remaining question is still: Is this in a Development environment or a Production environment?

Regards,
Ockert
Badge +3
it was in a development environment.

anyway, on a different note (but same topic), is there any way to delete a process instance programmatically (and not from k2 service manager) like maybe a method in k2rom that does this?

thanks
Badge +11
Yes, you can use the K2Mng object model. Have a look in the Help file and specifically at the K2Manager class' DeleteProcessInstances method.

Be careful though,

Ockert
Badge +3
Oh, I see. Thanks.

But now I realized what if I want to delete/remove a specific worklist item though? Is that possible?
Badge +11
No, it's not possible. The question is: Under what circumstances would you want to delete Worklist items?

It would be better to open the Worklist item and Finish it.

Regards,
Ockert
Badge +3
I see.

The reason is this: There is an an external party (XDA) communicating with K2 via a windows service. There is supposed to be a 'cancel request' capability and that in turn, will make the workflow proceed to its "Cancelled" activity. The windows service will be the one to check from an outside SQL database for requests with status asking for cancellation.

The windows service is the one opening the k2rom connection via a service account supplied (only one user can log in when using a windows service). Once the workflow starts (when a new request comes in), it will go through a series of approvers. Now these succeeding approvers accesses their worklist from the browser. BUT the request for cancellation is coming from outside. So, the windows service is looping through the service account's worklist - but the approvers is not using a service account, of course. they are using their own NT account. So see, there is NO way that the windows service (k2 connection) can ever see the approver's worklist since it is logged on as the service account and not the approver's NT account.

with me so far? so anyway, the approvers' worklist can only be opened IF these approvers are subordinates of the service account, right? it should be defined in active directory. and here comes the problem. our client does not allow that - for a service account's properties set to subordinate everyone else because of security issues and other major impact on their other global applications.

i was thinking of a workaround regarding that problem. deleting the worklist item once cancelled was triggered was one. but i see that it is not possible.

so anyway, that's the situation.
Badge +11
It sounds like you should make use of the K2Manager.GotoActivity method of the K2Mng to redirect the whole process instance to the 'Cancelled' Activity - in effect expiring all Worklist items and active Activity instances and instantiating the 'Cancelled' Activity.

Hope this helps,
Ockert
Badge +3
that could be an option.

on the other hand, just a quick question. is it possible to SET the status property of the worklist? like maybe set it to "Deleted"? would you also recommend setting that in the K2Log database where the worklist is located?

thanks so much. i'm sorry for the tons of questions. our client is also trying to find a workaround for this and the one above is one of their suggestions.
Badge +11
No, as far as I know, not possible through any K2.net API.

You can Release, Redirect and Sleep worklist items which, in the case of Release and Sleep will change the current Status of the Worklist Item but you can not change the Status to some custom value.

Sorry,
Ockert

Reply