Skip to content
Fetching contributors…
Cannot retrieve contributors at this time
85 lines (67 sloc) 3.33 KB
title description details review tree_item_index toc
HOWTO: Assign a Task to the User Manager
This page provides the instructions to assign a task according to the task performer properties.
excerpt level tool topics
This page provides the instructions to assign a task according to the task performer properties.
LDAP, Workflow
comment date status

This tutorial explains how to dynamically assign a task to the user manager.


  • Start by following this [HOWTO: Add New Fields to the User Profile or Group Profile]({{page version='' space='nxdoc' page='how-to-add-new-fields-to-the-user-profile-or-group-profile'}}).
  • On your Studio project, in Modeler > External Templates, install the Default Nuxeo Platform Configuration template.

Use Case

We create a simple workflow template with only one validation task, sent to the document creator manager.

Create a Document Property to Store the User Manager

To complete this use case, we use a technical document property to store the manager information. For this tutorial, we will use the File schema, and create a file_schema:manager property, of type User/Group, with a restriction to be exclusively a User.

To do so:

  1. In Modeler, go to Content Model > Document Types and click on File.
  2. Go to the Schema tab and add a new field manager, type User/Group.
  3. Save your modifications.

Create a Workflow Template

  1. In Modeler, go to Workflow and create a new workflow:
    • Feature ID: WF_Automatic_Task_Assignment
    • Label: Automatic Task Assignment
  2. Click on Ok
  3. Go to the Graph tab and drag and drop an Approve task.
  4. Edit the task, and on the field Assignees expression put:
  5. Click on Save
  6. Connect the Start and End points to the approve task and save your modifications.

Create the Automation Chain

  1. In Modeler, go to Automation > Automation Chains and create a new chain Set_WorkflowManager.
  2. Click to Switch editor at the top of the page and copy/paste the following chain:
    - Context.FetchDocument
    - Document.SetProperty:
        xpath: "file_schema:manager"
        save: "true"
        value: "@{CurrentUser[\"user:manager\"]}"
  3. Save your modifications.

Create the Event Handler

  1. In Modeler, go to Automation > Event Handlers and create a new event handler EH_AC_SetAssigneeTask:
    • Events: Document created
    • Current document has one of the type: File
    • Chain or script: Set_WorkflowManager
  2. Save your modifications.

Generate the Workflow Task Layouts

  1. Navigate to Designer > UI > Layouts > Workflows > and click on Configure Missing Layouts.
  2. Save your modifications.

Deploy and Test your Configuration

  1. [Deploy your changes]({{page version='' space='nxdoc' page='nuxeo-dev-tools-extension'}}#hot-reload).
  2. Create a user boss and a user jdoe, and set boss as jdoe's manager
  3. Log in as jdoe and create a File document type.
  4. Launch the Automatic Task Assignment workflow on it.
  5. Log out and log in as boss.
    The user boss has a validation task!
You can’t perform that action at this time.