Importing Related Content - Documentation topics on: importing related content,relating content,relating structures,relationship,relationships,.

This documentation is a static copy for this version. For current documentation, see: http://dotcms.com/docs/latest

Importing Related Content

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.

Two Related Content Content Types

In the image shown below, a relationship has been created between two different Content Types - Employee and Location. Several locations have already been created as content in the system.

Using the CSV file show below, employeess can be imported AND related to the location contentlets that already exist in the system. This is achieved by including an extra column that has the relationship name in the header and lucene queries in each row that match the location(s) that each employee can work at.

On import, dotCMS will read the lucene query in each row and relate one or many contentlets (in this case locations), to the employees being imported. After the import, editing the employee content reveals the related location under the Relationships tab.

Importing Content to a Self-related Content Type

When importing content with a self-join relationship, as in the example below, the header of the relationship column should indicate which side of the relationship the content should be imported from.

Importing CHILD Content: When -RELPARENT is appended to the end of the related content column header, then the results of the lucene query will be considered the parent content and the rows being imported will become their children.

Importing PARENT Content: When -RELCHILD is appended to the end of the related content column header, then the results of the lucene query will be considered the child content and the rows being imported will become their parents.

Special Note: If no option is appended to the header when importing self-related content, the -RELPARENT becomes the default and the content being imported is considered the child of the content pulled by the lucene in the relationship column.