Workflow autoStart

Hello,

Is there any way to make a workflow autostart, once a form is filled or a document is uploaded, that will be a serial approval workflow and if all, in this example 3 approvers accept the document gets moved to a separate folder ?

Or something similar, I am looking for a tutorial, as this is the first time I am using nuxeo and am still unfamilliar with it.

Thank you for you help.

Ovidiu

0 votes

1 answers

2127 views

ANSWER



Hi,

what you are looking for is basically the process described here:

https://doc.nuxeo.com/display/NXDOC/How+to+Set+a+Default+Date+on+a+Field+at+Document+Creation

You can use an event handler like this:

 <extension target="org.nuxeo.ecm.core.operation.OperationServiceComponent" point="event-handlers">
    <handler chainId="ApprovalWorkflowChain">
      <event>documentCreated</event>
      <filters>
        <doctype>TestDoc</doctype>
      </filters>
    </handler>
  </extension>

Then you have the automation chain starting the workflow:

<extension target="org.nuxeo.ecm.core.operation.OperationServiceComponent" point="chains">
   <chain id="ApprovalWorkflowChain">
      <operation id="Seam.GetCurrentDocument"/>
      <operation id="Context.StartWorkflow">
        <param type="string" name="id">MyApprovalWorkflow</param>
        <param type="boolean" name="start">true</param>
      </operation>
    </chain>
</extension>

In the workflow you can also call an automation chain to move documents:

You can just call your three person approval workflow there. In there you can call automation chains to move documents like this:

<extension target="org.nuxeo.ecm.core.operation.OperationServiceComponent" point="chains">
    <chain id="approved">
      <operation id="Seam.GetCurrentDocument"/>
      <operation id="Document.SetLifeCycle">
        <param type="string" name="value">approved</param>
      </operation>
      <operation id="Document.Move">
        <param type="document" name="target">/asset-library/Approved</param>
        <param type="string" name="name">expr:Document.name</param>
      </operation>
      <operation id="Seam.NavigateTo">
        <param type="string" name="view">expr:Document.id</param>
      </operation>
    </chain>
</extension>

Hope this helps you.

0 votes



Thank you for your answer ssze, I will test it out in the next weeks to come and update here if all is ok.

Thanks again!

Ovidiu

08/13/2015