Handle updating process of a document through a workflow

We tried to make OpenKM as intuitive as possible, but an advice is always welcome.
Forum rules
Please, before asking something see the documentation wiki or use the search feature of the forum. And remember we don't have a crystal ball or mental readers, so if you post about an issue tell us which OpenKM are you using and also the browser and operating system version. For more info read How to Report Bugs Effectively.
Post Reply
mamad
Expert Boarder
Expert Boarder
Posts: 140
Joined: Mon Jun 25, 2018 5:13 am

Handle updating process of a document through a workflow

Post by mamad »

Hello guys
I want to handle updating process of a document through a workflow in openkm. For example consider the situation that user1 requests for updating a document .after pressing update button and uploading the new version of document, a workflow instance starts and a request will send to the user2 through the workflow. After that if user2 confirm the updating then the document should be update automatically otherwise the updating process should be terminate . Is it possible to do this process through a workflow in openkm ?
(im using openkm 6.3.7 community edition)
Thanks in advance
jllort
Moderator
Moderator
Posts: 11399
Joined: Fri Dec 21, 2007 11:23 am
Location: Sineu - ( Illes Balears ) - Spain
Contact:

Re: Handle updating process of a document through a workflow

Post by jllort »

You want a process for validating a document before accepting the change. This is not a trivial scenario, the document should be uploaded in temporary destination, link with the document to be updated, validate and then update the document and finally delete the temporary document.

A way to simplify it maybe:
prerequisits
1- documents have unique name in your system

Logic
1- new version of document is uploaded in a specific folder for this purpose
2- start workflow
Because there'are two documents with same name and one of them is located in a path what helps to identify as the last version you can create a process at the end to get contents and update in final destination ( take a look at https://docs.openkm.com/kcenter/view/ok ... getContent , https://docs.openkm.com/kcenter/view/ok ... l#checkout and https://docs.openkm.com/kcenter/view/ok ... ml#checkin
mamad
Expert Boarder
Expert Boarder
Posts: 140
Joined: Mon Jun 25, 2018 5:13 am

Re: Handle updating process of a document through a workflow

Post by mamad »

Hi @jllort and thanks for your reply
It seems your solution is practicable but there are some ambiguities here too
Based on your explanations i think this may be the whole scenario with more details :

1- First of all i should create a rule inside automation action with "Document Update" event and "Execute Scripting" action with "Pre" type to execute some codes before updating documents. In the script i have to cancel updating process (actually i don't know how to prevent updating document) and move the updated version of document to a temporary path as a new document ( also i don't know how to get the uploaded document).

2- I need another automation action rule with "Move Document" event and "AddWorkflowToWizard" action which run an instance of my workflow whenever a document moved. There is another problem here and that's i should check the destination path of the movement to run the workflow only if the destination path is same as the temporary path ( to prevent running the workflow for other movements) and i don't know how to get the destination path of the moved document.

3- Finally, In my workflow i will check the conditions. If they satisfy the requirements then i should update the document. So i should write a class which update that document and delete the temporary file.

Is this a right and practicable scenario ? If yes please tell me how to solve the ambiguities.
jllort
Moderator
Moderator
Posts: 11399
Joined: Fri Dec 21, 2007 11:23 am
Location: Sineu - ( Illes Balears ) - Spain
Contact:

Re: Handle updating process of a document through a workflow

Post by jllort »

1- When you upload a new document, you know the name and there you can identify if the document already exist. In case positive, move to another folder and starting with the workflow. Everything can be done in the same action ( document creation )
2- WorkflowWizard in move action will not work. UI currently only supports wizard from creation. But you can use document creation for it.
3- At the end of the workflow if all conditions are satisfied, might update the related document ( maybe at the end delete the document linked with the workflow because will no longer be used, or move to a folder to remove later ).
Post Reply