Web UI

HOWTO: Customize Workflow Tasks

Updated: June 21, 2017 Page Information Edit on GitHub

The View Designer is not available for everyone yet, but if you can't wait any longer to try it, do not hesitate to contact your sales representative to enable it on your project.

This how-to works with the latest 9.2 snapshot version of the server and Nuxeo Web UI.

In this tutorial you will learn how to create a custom workflow tasks layout in View Designer. We'll be using a custom validation workflow template linked to the Contract document type.

Prerequisites

  • A Contract document type created in Nuxeo Studio
  • Web UI addon installed on your instance
  • View Designer enabled on your Studio project

Create a Workflow Template

First, we need to create a new workflow template in Nuxeo Studio. This workflow will be applied to the Contract document type.

  1. Go to Workflow > Process Definitions and click on New.
  2. On the Activation tab, next to the field Current document has one of the types, select the Contract local type and move it from left to right. Now we will add a custom workflow variable called Type to specify which type of contract you are validating.
  3. On the Variables tab, add a field type as a string.
  4. On the Graph tab, select an Accept/Reject user tasks and drag and drop it on the graph.
  5. Click on the Edit button next to the task.
  6. Fill in the General tab as shown below:
  7. On the Variables tab, activate the custom variable by moving it to the right box.
  8. Save your changes. You should end up with a graph like this:

We will finish our Nuxeo Studio configuration by creating a vocabulary for the Type variable, to be able to select the type from a drop down list during the workflow process. The vocabulary will be composed of three different types of employment contract.

  1. Go to Vocabularies and click on New
  2. Fill in the rows like this:
Id Label
full-time-part-time Full-time and part-time
fixed-terms Fixed-term
freelance-consultant-contractor Freelancers, consultants, contractors
  1. Save your modifications.

Create a Task layout

We can now customize our layout on View Designer.

  1. On the Layouts tab, go to the Workflows menu and click on Contract Validation task and then on CUSTOMIZE. The workflow layout works as the document type layout, you can browse the element catalog and switch editors between code and visual.
  2. You can start by reorder the properties on the visual editor to end up with something like this:
  3. Switch to editor from visual to code and change the line corresponding to the type field to turn it into a nuxeo-directory-suggestion to link the type property to the associated directory:
    <nuxeo-directory-suggestion role="widget" label="Type" placeholder="Select the contract type..." value="" directory-name="type" min-chars="0"></nuxeo-directory-suggestion>
    
  4. Save your changes.

You can now deploy your project on your instance and see what it looks like!

Technical Overview

Workflow Tasks

Each workflow task has its own form defined by a dedicated element. This form is excluded from the vulcanization process and is therefore dynamically loaded.

In the $NUXEO_SERVER/nxserver/nuxeo.war/ui/ directory, you can see:

└── workflow
    ├── nuxeo-document-task.html
    ├── nuxeo-document-task-review-result.html
    ├── paralleldocumentreview
    │   ├── nuxeo-task2169-layout.html
    │   ├── nuxeo-task2556-layout.html
    │   └── nuxeo-task328d-layout.html
    └── serialdocumentreview
        ├── nuxeo-task38e-layout.html
        ├── nuxeo-task542-layout.html
        └── nuxeo-task6d8-layout.html

By convention, a $NUXEO_SERVER/nxserver/nuxeo.war/ui/workflow/{worfklowName}/nuxeo-{taskId}-layout.html file defines the form layout of the task with task ID {taskId} for the workflow {worfklowName}.

3 days ago Solen Guitter Insertion of NX University links
9 days ago Manon Lumeau 810 how to in FT
2 months ago manonlumeau NXDOC-1181:WIP
History: Created by manonlumeau