Add a Custom MetaData to Nuxeo DMS LTS
In the enterprise edition of Nuxeo DMS, the metadata can be added through Nuxeo Studio which is a part of the Nuxeo Online Services and isn’t available for the community edition. However, you can still add custom metadata fields in the Nuxeo DMS community edition. The custom metadata fields can be added by creating or modifying XML contributions directly. This requires a bit more technical knowledge, as it involves working directly with Nuxeo’s underlying extension point system.
Follow these steps to add custom fields to a document type in Nuxeo DMS LTS
- Create a Custom Schema
First, you’ll need to define a new schema for your custom fields. Create a file named my-schema-contrib.xml
in nxserver/config
with the following content:
<component name=”org.example.myapp.schema.contrib”>
<require>org.nuxeo.ecm.core.schema.TypeService</require>
<extension target=”org.nuxeo.ecm.core.schema.TypeService” point=”schema”>
<schema name=”mySchema” src=”schema/mySchema.xsd” />
</extension>
</component>
This contribution tells Nuxeo to load a schema from a file named mySchema.xsd
.
2. Define the Schema
Next, create the mySchema.xsd
file in nxserver/config/schema
:
<xs:schema
xmlns:xs=”http://www.w3.org/2001/XMLSchema">
<xs:element name=”expiryDate” type=”xs:date” />
<xs:element name=”customerId” type=”xs:string” />
<xs:element name=”accountNo” type=”xs:string” />
</xs:schema>
This file defines a schema with three fields: expiryDate
, customerId
, and accountNo
.
3. Add the Schema to a Document Type
Finally, you’ll need to add your custom schema to a document type. You can either create a new document type or extend an existing one. For example, to add the schema to the File
document type, create a file named my-doctype-contrib.xml
in nxserver/config
:
<component name=”org.example.myapp.doctype.contrib”>
<require>org.nuxeo.ecm.platform.types.local.configuration</require>
<extension target=”org.nuxeo.ecm.core.schema.TypeService” point=”doctype”>
<doctype name=”File” extends=”Document”>
<schema name=”mySchema” />
</doctype>
</extension>
</component>
This contribution adds the mySchema
schema to the File
document type.
After making these changes, restart the Nuxeo server to apply them.