Exporting and Importing Object Definitions

Liferay 7.4 U68+/GA68+

You can export and import object definitions as .json files. These files include the definition’s complete schema (e.g., configurations, fields, actions, and relationships).

When exporting definitions with relationships, the JSON file includes all relationships defined in the current object, as well as many-to-many relationships defined in other objects. However, the file does not include one-to-many relationships defined in other objects.

You can also export and import object entries together with their definitions and relationships in LAR files, along with other content.

If an imported definition references picklists or objects that do not exist, Liferay automatically generates them using the external reference codes provided in the exported JSON.

Tip

You can use a batch client extension to help migrate object definitions between Liferay environments, using previously exported JSON files. See Batch Client Extensions for more information.

Exporting Definition JSON

  1. Open the Global Menu (Global Menu), go to the Control Panel tab, and click Objects.

  2. Under Object Folders, select the folder including your desired object definition.

  3. Click Actions (Action Button) for the desired object and select Export Object Definition.

    Click the Actions button for the desired object and select Export Object Definition.

The object definition downloads as a JSON file. Once exported, you can import the object definition into compatible Liferay environments.

Importing Definition JSON

  1. Open the Global Menu (Global Menu), go to the Control Panel tab, and click Objects.

  2. Under Object Folders, select the folder where you want to import the object definition.

  3. Next to the object folder name at the top of the screen, click Actions (Action Button) and select Import Object Definition.

    Click the Actions button in the Application Bar and select Import Object Definition.

  4. Enter a name for the object. You can edit this value after importing.

    Important

    Object names must be unique and use PascalCase.

  5. Select a JSON file to import.

    Once selected, the modal window displays the definition’s external reference code (ERC). You can edit the ERC after importing.

    Enter a name and select the desired JSON file.

  6. Click Import.

The object definition begins importing in the background and can take a few minutes.

Exporting/Importing via LAR File

Liferay 2025.Q2+/GA135+

Note

Exporting and importing instance-scoped object entries requires a developer feature flag. Set feature.flag.LPD-35914=true to enable the Export and Import options in the Applications menu.

You can also move object entries and their relationships between sites or Liferay instances via LAR exports and imports. Export or import instance-scoped objects from the Export and Import links in the Applications menu (Applications menu), and export or import site-scoped objects from the site menu.

Note

Local live and remote staging do not support publishing objects.

Use the export/import options in the Applications menu for instance-scoped object entries, and in the site menu for site-scoped object entries.

Select the object definitions under Content to export its entries. You can also replicate deletions in your LAR export by selecting Export Individual Deletions in the configuration menu. Any object entries with these definitions, as well as their relationships, are included in the data in the LAR file.

Select the object definitions to export all associated object entries with them.

You can use the exported LAR file to import the object entry data via the Import menu in another site or Liferay instance. When you import the LAR file, the target Liferay instance must also have the included object definitions already present, or an error occurs when you select the file.

If the included object definitions are not present in the target Liferay instance, an error appears.

To make sure both Liferay instances have the same object definition (including an identical class name), export and import the necessary definitions as JSON before you attempt the LAR import.

Capabilities

Product

Education

Contact Us

Connect

Powered by Liferay
© 2024 Liferay Inc. All Rights Reserved • Privacy Policy