Nuxeo Server

How to Query Workflow Objects

Updated: November 13, 2017 Page Information Edit on GitHub

Workflows are stored in Nuxeo as documents of type "DocumentRoute". A workflow instance is created by copy from a workflow model. The lifecycle state for a workflow model is "validated", while the instances can be "running", "done" or "canceled".

A node in the workflow is stored as a document of type "RouteNode". A node has an unique id generated by Studio, set on the rnode:nodeId property. Nodes can be automatic steps or nodes of type task. If a node is of type task, that means a task (persisted by default as a document of type TaskDoc) is created when the workflow is executing that node. The workflow will be resumed only when this task is completed.

Since workflows, nodes and task are all documents, the NXQL query language can be used, like on any other document type.

Querying Workflows

Using Lifecycle State

Query all running workflows:

Select * from DocumentRoute where ecm:currentLifeCycleState = 'running'

Query all available workflow models:

Select * from DocumentRoute where ecm:currentLifeCycleState = 'validated'

Using Workflow and Node Variables

Both workflow and node variables are persisted on the workflow and node documents. These are metadata stored on a dynamic facet, in a schema named as following:

  • for workflow variables, the name of the schema (and its prefix too) is var_$WorkflowModelName,
  • for node variables, is var_$NodeId.

The name of this facet is stored as the property:

  • docri:variablesFacet on the workflow documents
  • rnode:variablesFacet for nodes.

So both workflow and node variables can be queried as any other Nuxeo property.

Query all running default serial workflows, having the global variable "initialComment" set to "test"

Select * from DocumentRoute where var_SerialDocumentReview:initiatorComment = 'test'

Querry all running workflows for a given document

Select * from DocumentRoute where docri:participatingDocuments IN ('$docId') AND ecm:currentLifeCycleState = 'running'

Querying Workflows Suspended at a given Step

NXQL queries can reference any metadata. Using the CoreSession#queryAndFetch API we can look for workflows suspended on a given step. This will return in an IterableQueryResult the id of the document representing the workflow document.

Select ecm:parentId from RouteNode  where rnode:nodeId = 'Task5237' and ecm:currentLifeCycleState = 'suspended'

where 'Task5237' is the unique id of the node.

Querying Workflow Tasks

Query for all opened tasks

Select * from TaskDoc where ecm:currentLifeCycleState = 'opened'


4 days ago manonlumeau Added content-review-lts2017 label
a month ago manonlumeau NXDOC-1346-FT review screenshot
3 years ago Solen Guitter 51 | ix links to point to latest versio
3 years ago Manon Lumeau 50
3 years ago Manon Lumeau 49
3 years ago Manon Lumeau 48
3 years ago Manon Lumeau 47
3 years ago Manon Lumeau 46
4 years ago Solen Guitter 45
4 years ago Solen Guitter 44
4 years ago Solen Guitter 43
4 years ago Solen Guitter 42
4 years ago Alain Escaffre 41
4 years ago Mariana Cedica 40
4 years ago Mariana Cedica 39
4 years ago Solen Guitter 38 | Added excerpt
5 years ago Solen Guitter 37
5 years ago Solen Guitter 35 | Added related pages and format
5 years ago Solen Guitter 36
5 years ago Mariana Cedica 34
5 years ago Mariana Cedica 33
5 years ago Mariana Cedica 32
5 years ago Mariana Cedica 31
5 years ago Mariana Cedica 30
5 years ago Mariana Cedica 29
5 years ago Mariana Cedica 27
5 years ago Mariana Cedica 28
5 years ago Mariana Cedica 26
5 years ago Mariana Cedica 24
5 years ago Mariana Cedica 25
5 years ago Mariana Cedica 23
5 years ago Mariana Cedica 22
5 years ago Mariana Cedica 21
5 years ago Mariana Cedica 20
5 years ago Mariana Cedica 19
5 years ago Mariana Cedica 18
5 years ago Mariana Cedica 17
5 years ago Mariana Cedica 16
5 years ago Mariana Cedica 14
5 years ago Mariana Cedica 15
5 years ago Mariana Cedica 12
5 years ago Mariana Cedica 13
5 years ago Mariana Cedica 11
5 years ago Mariana Cedica 10
5 years ago Mariana Cedica 8
5 years ago Mariana Cedica 9
5 years ago Mariana Cedica 6
5 years ago Mariana Cedica 7
5 years ago Mariana Cedica 5
5 years ago Mariana Cedica 4
5 years ago Mariana Cedica 3
5 years ago Mariana Cedica 2
5 years ago Mariana Cedica 1
History: Created by Mariana Cedica