3- Creating the Main Workflow

This document is part of the Sub Workflow Example project series.

What Will We Do In this Step?

We will create the main workflow that will call a subworkflow depending on the document's metadata, and pass it variables along the way.

Creating the Workflow

  1. In Nuxeo Studio, go to Workflow > Process definitions and click on the New button.
  2. Fill in the fields:

    • Feature ID: expenseValidation
    • Label: Expense validation
    • (Optional) Description: Request your expense validation.
  3. Click on the Ok button.

Activtion Tab

This workflow will be a wrapper for the subworkflows. So contrarily to the previous ones we created, it should be visible to the users.

  1. In the "Current user has one of the permissions" list, choose Edit.
  2. In the "Current document has one of the types" list, choose Expense.
  3. In the "Current document has life cycle" field, type project. We wouldn't like to launch the workflow on validated expenses.
  4. Save your modifications.

Graph Tab

  1. Drag and drop the following nodes on your graph:

    • A Start node.
    • A Sub Workflow node.
    • An end node (Stop).
  2. Link the start node's output transition to the subworkflow node.
  3. Link the subworkflow's output transition to the end node.
  4. Save your modifications. Your graph should look like this:

Edit the Sub Workflow Node

General Tab

Set the following values:

  1. Title: Validation request

  2. Workflow: We will use an MVEL expression to determine which workflow should be run. Type the following expression in this field: @{Document["expense:amount"] < 100 && Document["expense:expensetype"] != 'Misc' ? 'subOneLevelValidation' : 'subTwoLevelsValidation'} This implements our business logic rule, by checking the expense's amount and its type. If under $100 and not in the misc category, then we call a one level validation, otherwise a two-level validation. Result below (as seen in the expression editor because it is a rather large expression):

  3. Workflow variables: This field determines which variables we will send to the sub workflow that is called. Note that to be able to use it in your subworkflow, it has to be set in the subworkflow Variables tab; as we did this already in the previous step, we're fine. Each value has to be set on a separate line, so we will fill this field as following:


    Look at the result below:

  4. Save your modifications in the node and on the graph.

You are now all set! This tutorial is merely a basic example of what can be achieved with the sub workflow functionality; the rest is up to your imagination.

22 days ago Manon Lumeau Fix typo on HTTPs
4 years ago Manon Lumeau 13 | eplace "Write" by "Edit"
5 years ago Manon Lumeau 12 | formatting
5 years ago Solen Guitter 11 | Fixed broken links
6 years ago Solen Guitter 10
6 years ago Bertrand Chauvin 9
6 years ago Bertrand Chauvin 8
6 years ago Bertrand Chauvin 7
6 years ago Bertrand Chauvin 6
6 years ago Bertrand Chauvin 5
6 years ago Bertrand Chauvin 3
6 years ago Bertrand Chauvin 4
6 years ago Bertrand Chauvin 2
6 years ago Bertrand Chauvin 1
History: Created by Bertrand Chauvin

We'd love to hear your thoughts!

All fields required