Import/Export Email Templates

Organization email templates, found under Organization administration > Setup > Organization email templates (up to app ver 8.1 Organization administration > Setup > Email templates), have been enhanced by Docentric and therefore contain some custom data fields. The instructions below will guide you how to export and import Organizational email templates extended by Docentric, using built-in Data management.

Following scenarios will be covered:

  1. Exporting organizational email templates for all the companies (legal entities) into an external XML file
  2. Importing email templates from an external XML file
  3. Copying email templates from one legal entity into one or more other legal entities within the same D365FO environment.

Background explanation

Docentric AX extends the D365FO’s built-in Email templates table (SysEmailTable) with certain set of fields. Two new data entities have been provided to support the data management of the extended tables:

  1. Docentric organization email templates (DocSysEmailTableEntity)
  2. Docentric organization email messages (DocSysEmailMessageTableEntity)
System email templates (System administration > Setup > Email > Sysem email templates) have also been supported in similar manner by Docentric. Two new data entities were introduced (DocSysEmailSystemTableEntity and DocSysEmailMessageSystemTableEntity) and supported by the Data management framework.

Import/Export limitations

Email templates may contain messages larger than 32768 characters. According to D365FO’s documentation, export and import jobs by design use SQL Server Integration Services to fill staging tables. This imposes a limitation that a field imported from an external file can only contain up to 32768 characters. Exceeding content may be truncated. In our test scenarios, however, we were able to perform all export and import without truncation if we chose export to and import from XML file using XML-Element as target data format.

Export and import to/from other formats, like Excel or CSV, would require some extra work with base64 conversion and splitting contents into chunks to overcome truncation. This scenarios are not supported in our solution.
Legal entity to legal entity copying does work without any truncation.

Scenario 1: Export to XML

You want to export all the email headers and related message contents into an XML file – either for backup or to transfer settings into another environment. This can be accomplished by creating an Export Data project in Data management workspace.

Step-by-step instructions:

  1. Open the Data management workspace. Make sure you see the Enhanced view, if you don’t you can toggle the view in the left upper corner of the form. Next, click on the Export tile.

  2. You are now setting up a new export data project. Fill-in the Group name and Description text boxes in the Export tab. You can optionally change the default value in the Project category drop-down list, should you want to further segregate your data projects.

  3. Next, click on Add entity drop-down list to open the Add entity dialog. Select XML-Element in the Target data format drop-down list.


    Do not choose XML-Attribute, because email contents will be hard to read when they span over multiple lines as xml attribute is meant for one-line contents. XML element, however, will display each field in its own element and multi-line contents will be much easier to read.

  4. Start typing Docentric o in the Entity name text box to see the Docentric organization email entities and select Docentric organization email templates.

  5. Click the Add button to add this entity to the list of entities for the export.

  6. Repeat steps 3 to 5 for the Docentric organization email messages. This entity will be added to the list.

    Some notification messages might appear informing you about possible data truncation. These messages can be safely ignored in our case.

    Now click somewhere outside this dialog to close it.

  7. Save the data project by clicking the Save button as shown on the figure below. Now the export data project is set up and you can run it by clicking on Export button.

  8. While the export is being executed you will be able to refresh the status of this export job.


    Once the export is finished, its result (hopefully Success) is displayed:

  9. Now you can download the resulting XML files to your local machine. You just select the data entity in the Entity processing status tab and click Download file. Your browser will now initiate file download. Repeat this for the second data entity as well. The figure below shows this process in Chrome browser.

  10. Last but not least, you should check the execution log by clicking on View execution log on the upper left part of the window.


    Check the Docentric organizational email templates export log first. On the figure above you can see that there is nothing in the Log text text box.

    Next, you should check the Docentric organizational email messages export log.


    There is nothing in the Log text field as well, meaning there were no warnings or errors.

Scenario 2: Import from XML

You want to import settings from the XML file, formerly exported from the same or from another environment.

During the import, existing email templates with the same email ID, language ID and company ID are overwritten and non-existing ones are created. If you are importing email templates from other environment, you should make a backup of the existing ones.

Step-by-step instructions:

  1. Open the Data management workspace. Make sure you see the Enhanced view, if you don’t you can toggle the view in the left upper corner of the form. Next, click on the Import tile:

  2. Fill-in the Group name and Description text boxes.

  3. Now you will choose the first XML file from which you will import. Click on the Add file button in the Selected Entities tab. The Add file dialog opens. Make sure that XML-Element is chosen in the Source data format drop-down list.


    Start typing Docentric in the Entity name text box to show a drop-down list of all the Docentric entities and select the Docentric organization email templates and click on the Upload and add button.


    The file selection dialog will appear. Choose the XML file with email templates. Make sure that you haven’t accidentally chosen email messages.


    The XML file should be added as shown in the figure above. Note the messages at the top.

  4. Repeat step 3 also for the Docentric organization email messages.


    This XML file has been added as well. First three messages at the top tell you that information has been loaded and that the mapping has completed successfully. The warning messages can be ignored.

    Click outside of Add file dialog to close it.

  5. Click Save to save the data import project. To run the import, click the Import button.

  6. After the import job has finished you should inspect the execution summary, to see if import has been successful and how many records were created and how many updated.


    To see even further details, click the View execution log button in the upper part of the window.

  7. The Execution log form shows import details and log messages, generated during import. Since you imported data from two XML files – email templates and their messages, you see two cards on the left side of the window. As you click on each of these cards, you see their respective log text, generated by the import job. Check this log text for warnings or errors.


    There is nothing suspicious in the log text in the figure above and in the one below – everything was imported successfully.

  8. Final check can be made by opening the Organization administration > Setup > Email templates menu.


    Change the company if necessary and check for new or updated email templates and their respective messages.

You want to export the email headers and related message contents from one legal entity to one or more other legal entities.

During copying, existing email templates with the same email ID, language ID and company ID in the target legal entity/entities are overwritten and non-existing ones are created.

Step-by-step instructions:

  1. Open the Data management workspace. Make sure you see the Enhanced view, if you don’t you can toggle the view in the left upper corner of the form. Then click on the Copy into legal entity tile.

  2. Enter the name and description into the Group name and Description text boxes. Note that the Source legal entity drop-down selection box contains the name of the currently selected legal entity.

  3. Now select one or more destination legal entities from the drop-down list.

  4. Click the Add entity drop-down selection box in the Selected entities tab and type Docentric in the Entity name text box to limit the list of entities shown.


    Select Docentric organization email templates and click on the Add button.

  5. Repeat previous step also for the Docentric organization email messages entity. The entity will be added to the list, but with some warnings.


    These warnings can be ignored, because the background copy job logic will make sure that fields will not be truncated.

  6. Now click on the Save menu button to save the changes. You can start this job by clicking on the Copy into legal entity menu button in the menu line in the upper part of the form.

  7. When the job is finished, you can see its execution summary.


    On the image above you can see, that the data has been copied.

  8. If you are interested in even more details, you can click on the View execution log button, where you can see if any errors or warnings have been recorded during job execution.


    In the case above, execution didn’t log any warnings or errors.

Now you can switch to the target legal entity to see the copied email templates.

See also

Import/Export Print Management Settings >>
How to Use Deployment Tools >>

IN THIS ARTICLE