Fill up a form when the document state is to be changed within a workflow
I have searched in the forum and answers however not been able to find anything that could help me. I am a newbie and your help will be greatly appreciated.
I have implemented Nuxeo 5.5 Document Management. Within the DM, the document life cyle has been modified, shortened it to 3 states Project, Approved and Client.
Project -> Approved -> Client ^ | | | | | ----------------------
Once the document has reached a certain maturity, it is sent off for an approval where it changes to amajor version. In certain cases, only approved documents are sent off to Client and this change of state is activated by running a single task workflow by the user before downloading and mailing the document.
If there are changes after the document is approved or sent to Client, the user edits and the document state automatically gets changed to project and the earlier version is preserved in history. The current version carries on with the last assigned version number -> changing version only after an approval lifecyle again.
I have 2 needs
- When the state is “Client”, it does not change back to initial project. This does happen with the “Approved” state though. An approved document automatically changes into project on editing. I want the same to happen with the “Client” document. I have compared the versioning rules and transistions within the plugin that I have deployed and there is no difference between the Approved and Client
How can I make this happen?
- In some very special cases, documents in certain folders only, when sent to “Client”, a form has to be filled up (a checklist and validation custom form) before the state changes. If the form is not filled, the state does not change or the task is rejected.
I am aware of automation chains and events in Studio however cannot seem to find how to create a custom form and attach it as a compulsary action within the workflow for certain conditions.
Is there a reference for this or a method I can achieve this?
Thank you very much in advance for your responses. I have tried searching without any success and any answers or references will help me greatly
1) For the first question if I well understand, you would like to automatically change the state of your document from Client to Project each time the document is modified, right?
Your lifecycle is good, now you have to create the treatment that will be triggered when the document is modified and when state is Client. In Studio this easy:
- Create an event handler attached to the Before document modification for document in the Client state lifecycle
- Attach the Event Handler to this following operation chain: fetch context > Follow Lifecycle Transition (with the name you gave for the transition
2) The second point will need a bit more work and I'm not sure to understand what you want to do.
Waiting that you will have to understand the Action notion, and layout system used to generate forms. Nuxeo IDE will help you to create an empty project.
When you have eaten that here is the way to do your stuff:
- create the validation form you want with Nuxeo Studio (Search and Listings > Layouts) and call it ClientValidation for instance
- create an empty project with Nuxeo IDE
- Create a xhtml view that just call the layout you create in Nuxeo Studio into the src/main/resources/web/incl/tabs/mytabs.xhtml
- Create a tab action (with the VIEW_ACTION_LIST category) and filter to let him displayed only for document in the state Client and for document into the given path. the label of the action will be "Edit" and the link value will be src/main/resources/web/incl/tabs/mytabs.xhtml
- Change the filter for the default Edit tab to not show it if the one create above is shown. Like that your form will be displayed instead the default one :D
That's all. This is not really hard in fact, even if you may feel through my explanation that is hard, but you have to understand many Nuxeo notion.
If you have question during the implementation of this, I suggest you to create a new question. Or you wait for the tab designer in Nuxeo Studio :D
Thank you. The first question, yes, you are correct. Whenever there is a modification to the document (even if by the edit tab and choosing an increment value) the state should automatically revert to project; as it does from the approved state.
For the answer to the first question, I think I understand. I will try it out and come back if I find any problems.
For the second point,
when document goes from approved -> client though a workflow, the user needs to be shown a form -> a checklist of things the user has supposed to have taken care off, before changing to the client state. In addition to the checklist [ticked using check boxes], the user shall have to fill a couple of other input fields.
Only if the user fills this form will the state change to client. Otherwise the workflow will be rejected.
In addition, this form is only needed for documents in certain folders. if folder name is "XYZ" and workflow is initiated from "Approved" to "Client" -> Task owner clicks approve -> out pops a form that the user fills. -> Task is approved and document state changes to "client".
if form is not filled or cancelled -> Task is reject and document stays "approved"
I hope I have been able to explain the second requirement better.
Btw, thanks for your answer. I had been waiting in anticipation for a few days hoping for someone to revert.
Many thanks once again.
Just to update that my first question was taken care of with your suggested answer. Thanks.
Will update on the Second.
I was finally able to get the validation form in a layout to show in the "Edit" Screen as per your suggestions.
I am however left with one small issue and I am posting it here so that perhaps you might be able to help me quickly.
The new layout with the form, I need to store the data (which is not in the standard schema or the metadata data usually shown in the normal edit screen). Any suggestions.
Thank you very much for the earlier help. Thanks to you, I am close to the solution and as well as learnt quite a bit about Nuxeo.