Guides and Tutorials

Implement the validation logic

Updated: October 16, 2020

The validation logic defines what happens when the user approves the document, and what happens when he rejects it. To do that, we will create 2 automation chains:

  • The validation automation chain,
  • The reject automation chain.

Validation chain creation

The validation automation chain will be used by the users with validationWorkflow_validation permission, to approve the document. It will:

  • change the lifecycle state of the document,
  • update the validation date property on the document,
  • log a "Spelling review achieved" on the document audit trail.

In this step, we will just create this chain, not adding anything to call it, neither a user action nor an event handler. Actually, the chain will be called if the user "accepts" the document's approval.

To implement the validation chain:

  1. Create the automation chain whose operations and parameters are given below. Don't bind it to any button or event handler, just create the chain.
  2. </ol>
    <p>
        <div class="large reveal" id="image_4a30407f63b04ed0292413a75509dc6a" data-reveal data-animation-in="fade-in" data-animation-out="fade-out">
        <img alt="" src="/assets/nxdoc/60/implement-the-validation-logic/Image 7.png" >
        <button class="close-button" data-close aria-label="Close modal" type="button">
        <span aria-hidden="true">&times;</span>
        </button>
        </div>
        <div class="">
        <img alt="" src="/assets/nxdoc/60/implement-the-validation-logic/Image 7.png" class="nuxeo border thumbnail" data-open="image_4a30407f63b04ed0292413a75509dc6a">
        </div></p>
    

Validation chain parameters

Operation Parameter 1 parameter 2
1 Fetch > Context Document _ _
2 Document > Follow lifecycle transition value: approve _
4 Document > Update property value: @{CurrentDate.days(7).date()} xpath: dc:valid
5 Services > Log Event In Audit event: Document_Validated category: automation

Reject chain

Like the validation chain, the refusal automation chain will be used by the users with validationWorkflow_validation permission, but to reject the document.

To implement the reject chain:

  1. Create the automation chain whose operations and parameters are given below. Don't bind it to any button or event handler, just create the chain.
  2. </ol>
    <p>
    

Reject chain parameters

Operation Parameter 1 parameter 2
1 Fetch > Context Document _ _
2 Services > Log Event In Audit event: Validation_rejected category: automation