How to Inherit a Metadata from a Parent Document

Updated: October 16, 2020

There are cases where you want a document to inherit some metadata values from its parent. In general, the goal is to benefit from the context of creation of a document to infer some metadata values. For instance, you can set a projet_id metadata on your document type and on the workspace (or any type of container). Then your document type can inherit the project id value from its parent workspace. This is also useful when most of your documents are captured via Nuxeo Drive. Since Drive doesn't enable to set metadata values, you can only infer them from parent containers.

In this how-to, we will implement an event handler, that will listen to the creation of documents. When the created document matches some predefined criteria, the listener will execute a content automation chain. The chain will copy the Dublincore "source" metadata value from the workspace to the created document.

To maintain inheritance, you need to use the event "Document Updated" and select the children document you want to update. This approach would work with a few documents below your parent documents only. For a larger number of documents, you should  consider a lower level approach.


To complete this how-to, you need the elements below to be already configured in your Nuxeo Studio project.

  • A document type called DocumentationItem.

Creating the Event Handler

To implement the metadata inheritance listener:

  1. Create a new Event Handlers (see how to bind an automation chain to an event handler).
  2. Fill in the filtering information below:
    • Events: Document created
    • Current document has one of the types: DocumentationItem
  3. Create the corresponding automation chain (see below for the chain parameters).

Creating the Automation Chain

Create an automation chain with the following operations and parameters:

- Context.FetchDocument
- Document.Push
- Document.GetParent:
    type: Workspace
- Context.SetVar:
    name: sourceValue
    value: "@{Document[\"dc:source\"]}"
- Document.Pop
- Document.SetProperty:
    xpath: "dc:source"
    save: "true"
    value: "@{sourceValue}"


We'd love to hear your thoughts!

All fields required