Updated: May 21, 2021

This section explains how to tailor the Nuxeo Retention addon to fit custom needs.

Add New Retention End Actions

By default, there are two retention end actions:

  • Document.Trash
  • Document.Delete

To add a custom end action, a new entry in the RetentionEnd vocabulary must be created.

The vocabulary entry ID corresponds to the automation chain or automation scripting you have created in Nuxeo Studio Modeler.

Automate vocabulary entry creation
It is not possible to automate the vocabulary entry creation from automation chain or automation scripting as the vocabulary is structured to be internationalized.

Add New Retention Events

As for the retention end actions, retention events are also referenced in a vocabulary called RetentionEvents. Custom events will be displayed in event-based retention rules.

Retention Automation Operations

If you need to implement custom logic with the retention addon, a set of automation operations are available:

  • Apply Legal Hold
  • Attach Retention Rule
  • Fire Retention Event
  • Remove Legal Hold
  • Set as Record and Retain Until

The operation definition is available in the Automation documentation (Use the Nuxeo Dev Tool Extension with the "Automation Documentation" quick link).


To use it in Nuxeo Studio:

  1. Click on the automation operation,
  2. Click on the JSON definition link,
  3. Copy-paste the JSON code into Nuxeo Studio Modeler > SETTINGS > Registries > Automation operations.

Create Custom Retention Rules

You can automate the retention rules creations in Studio. Retention rules are standard Nuxeo documents, of type RetentionRule. It can therefore be reused and customized.

Here is an example to create a retention rule with automation scripting:

var hr_contracts_properties = {
        "dc:title": "HRE-5000 - Employment Contracts",
        "dc:description": "Retention Rule for employee employment contracts",
        "retention_def:durationDays": 0,
        "retention_def:beginActions": [],
        "retention_def:durationMillis": 0,
        "retention_def:durationMonths": 0,
        "retention_def:startingPointPolicy": "event_based",
        "retention_def:startingPointEvent": "Retention.EmployeeDeparture",
        "retention_def:startingPointExpression": "employee:number",
        "retention_def:metadataXPath": null,
        "retention_def:durationYears": 6,
        "retention_def:endActions": [
        "retention_def:expression": null,
        "common:icon-expanded": null,
        "common:icon": "/icons/retention_rule.png",
        "retention_rule:applicationPolicy": "manual",
        "retention_rule:enabled": true,
        "retention_rule:docTypes": [

    var hr_contract_retention_rule = Document.Create(
      RetentionRules_location, {
        'type': "RetentionRule",
        'name': "RetentionRule_Contract",
        'properties': hr_contracts_properties

Retention Rules Location
You have to create the retention rules under the document of type RetentionRules. So ensure you have fetched it previously.

If you need to import the retention rule document type, then adopt the same strategy as extending the user schema:

  1. Import the necessary XSD schemas,
    1. retention_definition.xsd
    2. retention_rule.xsd
  2. Generate the schemas (and doctype) in the Content Model section.

We'd love to hear your thoughts!

All fields required