Importing Related Content

Last Updated: Aug 9, 2019
documentation for the dotCMS Content Management System

It's possible to import content that is related to one or more contentlets that already exist in the system. Content can be related on import regardless of whether the relationship exists between two different Content Types or the Content Type is related to itself.

Importing Content with Relationships

In the image shown below, a relationship field has been added on two different Content Types - Employee and Location. Several “Employees” and “Locations” have already been created as content in the system.

Relationship fields relating two contentlets

To import the desired content, choose the “Import Content” option instead of the add new content option on the Content Search manager.

Import related content

Choose the Content Type, content language version to import, a workflow action and, if needed, download the sample .CSV file.

Download a sample CSV file

Handling Existing Relationships

In the CSV file, the relationship field should be visible in the header. The imported CSV file can replace, remove, or preserve content using the following values:

Value Supplied for Relationship FieldResult
Comma separated list of identifiers and/or Lucene queriesReplace existing relationships (if any) with new relationships to the specified content.
Empty valueRemove all existing relationships (if any).
No column for the Relationship fieldPreserve (do not change) existing relationships (if any).

Add related content queries or content identifiers

Verifying the Import

Then upload the file and preview the import file for errors. The import of content with relationships will fail if there are any errors in the import preview report.

Preview the import and verify it is error free

Once you have imported the content with relationships, do a filter search for the related content, using the relationship field or edit a few pieces of content and verify that the relationships field has been populated with the related content data.

Verify the related data import

On this page

×

We Dig Feedback

Selected excerpt:

×