Import/Export
With Import / Export Utility it is possible to export structural elements of the DXP like layouts and input types, and import them to another environment, i.e website. This makes working with multiple environments i.e. for development, QA and testing much easier.
Import & Export are located in the System > Utilities area within the Core dna admin:
Export
Export is used to export “all” or “specific” entities & records from the website that can then be imported to another website on the Core dna platform. Entities that can be exported include “Layouts”, “Input Types”, “Custom Fields” and “Settings”.
To define which entities to include in the export simply enable/disable the toggle next to each entity, for example:
Once an Entity is enabled the Records dropdown will show with a pre-selected value “All”, meaning that all the available layouts records on this site will be included in the export. To select only specific layouts click on the records dropdown and select the layouts that should be included instead, for example:
Repeat the same process with the other entities if required:
Once all the Entities & Records have been selected click the “Start Export” button to download the .json file that will include all the selected information:
Export.json file will download within your browser, if using Chrome the file should appear at the bottom left corner:
The exported file can now be imported to a new environment or website. Check the instructions in the “Import” section of this document on how complete the import.
View / Read JSON File
The JSON file can be read by opening it using the Notepad / or Code editor tool. The JSON content will be presenter in one line, to make it easier to read copy the content and view it on one of the free JSON viewer tools online, for example:
Exporting Layouts
Layouts can also contain supported layouts (i.e nested layouts), in which case all the supported layouts and used input types will be included in the export files.
Example: if there is a requirement to move one component from one site to another, only the main “component” layout needs to be included in the export, and all the entities such as supported layouts and input types will be included in the export automatically. So there is no need to select the supported layouts or input types separately. But if you do it, every involved entity will be exported only once anyway.
Duplication Checks
In order to prevent duplication during imports, upon export an “UUID” is generated and assigned to each exported entity, which is then checked on each import.
Example One: In the event an user attempts to upload an export file twice the system will check the “UUID” first, if the “UUID” exists & “Update existing records” setting is disabled, the import will be skipped as the entities with the same “UUID” already exist. The same will happen if the user slightly modifies the Input Name and imports the file again, in this case the “UUID” will not change and the import will be skipped. However, if the “Update existing records” is enabled, then the new import (e.g. with modified Input Type name) will override the existing entities that share the same “UUID”.
Example Two: In the event an user attempts to import two files that contain the same entities, but have different “UUID”, both files will be imported successfully - even if the “Update existing records” is disabled because the entities are unique, and most likely come from two different websites.
Example Three: In the event an user attempts to import a record that contains an ”UUID” to a site that already has the same record, but does not have an “UUID” assigned. For example a “richtext” record. The import in this case will be executed, and the existing record which originally did not have an “UUID” will be updated with the “UUID” from the import file.
Import
Now that we have exported the JSON file from one website, the same export file can now be imported to another website on Core dna.
Note: template files are not included in the export, therefore they need to be separately uploaded via git. The export file only includes “Layouts”, “Input Types”, “Custom Field” & “Settings” information.
In order to import the exported JSON file login to destination site and navigate to the System > Utilities > and click on the Import utility:
The Import page consists of the following main areas and settings:
Export file Area: Drag and drop the export file in the export box to upload it to the system, or alternatively use the “Browse Assets” to upload the file from the system if it has been already imported, or use “Upload File” to upload the file from your PC.
Update existing records: Records that can be identified based on previous exports/imports or unique properties will be updated with this file. If not selected, records that already exist will be skipped.
Skip checksum checking: Exported file has a checksum based checksum to prevent changing. If you need to change some data in an exported file directly, use this setting for this. Be careful! Make sure all required and related data for changed one still exists and is not removed after changing.
Start Import: Initialise the import
Use case to enable “Update existing records”:
If the entities have been already uploaded, and the “Update existing records” is disabled the import will not execute, and no updates to the existing entities will be made
On the other hand, in the above scenario, if the “Update existing records” is enabled the export will execute, and any changes within the export file will be introduced to the system. In other words, the new import will overwrite the existing entities.
“Update existing records” setting is available for all users levels on the system
Use case to enable “Skip checksum checking”:
This setting is not available for all user groups, only “Developers”
This setting allows users (only users with “Developer” access) to import modified files to the system. For example, the user exports the JSON file, modifies it, and then imports it in the system - if the “Skip checksum checking” is disabled the import will be rejected, and if enabled the import will be executed.
Checksum Enabled
Checksum Disabled
Upon successful upload, all the entities within the export file will be added to the website and ready to use.