Skip to main content
Is it possible to iterate through all active instances of the process to see if another one exists with the same folio? I may even need to check another process in the same project to see if an instance exists there.

For example:
I have two K2 Event handlers for insert and update. The insert event starts the "Insert" process and the update event starts the "Update" process (ingenious naming conventions here :D). As a final step both the Insert and Updates processes call a third process in the same project.

I create a word document and save it to the library but don't close the document. The Insert process is initiated. I keep the document open and after a couple minutes save the document again. Now the Update process is initiated.

I need to stop one of the processes (most likely the second) since an instance is currently underway.

The idea I had was to check all instances of the Insert and Update processes to see if an active instance with the same Folio is found. If so then end the second process.

(a) is this possible? (please please please)
(b) if possible - how?
(c) if there is a better way - what is it?

Thanks in advance!!!
Hi Michelle,

Could you perhaps describe the business process that you are implementing. e.g. why would you kick off a process only to end it immediately?

If somebody saves updates to the document multiple times, you would have a new process instance for every update, what should happen then, and what must happen if the Process instance that was kicked off with the insert is already completed, should the update process instance also be 'stopped'?

If you say 'stop' the Process Instance, do you mean 'complete'?

Sorry 'bout all the questions, but I think the answer is not a simple one.
Hello Deon

What we have is a Document Management System using Sharepoint and K2 where a document can be edited by anyone and has to go through a review and approval process before it is published to a Sharepoint area library. A person would open the document from the published library and make edits then save the document back to the area library. This would trigger a workflow for review and approval. While the review and approval is happening no further edits should be allowed to the document from the area library (so the document is checked out to prevent this). However, the process doesn't check out the document right away because it needs to create a team workspace for the document and assign the correct team members for reviewing and approving to the team site, move the document etc. If it is an update the approved revision needs to be restored and the updated document is deleted from the area library so that users will only see the current approved document.

What I've noticed is that if a user edits or inserts a document, clicks Save and does not close the document (like Word) upon saving they can hit Save again which saves another version of the document to the area library and kicks off a new workflow process. That second workflow should not happen! The users can edit the document during the review/approve phase of the workflow in the team site until the document is approved and the workflow copies the approved document back to the area library (since it is now an official document).

I found this while I was updating the process to handle document locked issues when users have the document open and K2 tries to do something with the document in Sharepoint (update metadata, copy and delete etc.)

I hope that clarifies what we're doing a little more.
Hi Michelle,

Thanks for the additional info - it makes a bit more sence.
This is one of those cases where this forum is not the ideal tool to offer you a proper solution. A lot more talking and consulting is required to come up with the optimal solution.

Having said that, please allow me to make some comments based on limited knowledge of your solution:
- For this solution I think you must try to steer away from using the update event to start workflows, mainly for the reasons you mentioned, i.e. user hammering on the Save button.
- Make your published library read-only to prevent users from saving directly to the published library, instead have an updates library where they must store updates, this library will use the insert event to kick of your update process.
- After the update is approved, let the workflow save it to the published library.

Good luck!!!
Thanks Deon!
Hi

We had a similar problem - did you come out with a solution?

I take it you were working with event sinks.

Cheerio

Reply