Overview
With DataBridge it is possible to import XML files into SuperOffice CRM Online.
If you want to know what other types of files are supported, please visit our System Requirements page.
...
Consider the following example:
Code Block | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
| ||||||||||
<?xml version="1.0" encoding="UTF-8"?>
<companies>
<company>
<name>Company 1</name>
<contacts>
<contact>
<firstname>First name 1</firstname>
<lastname>Last name 1</lastname>
<phones>
<phone>+123</phone>
<phone>+456</phone>
</phones>
</contact>
<contact>
<firstname>First name 2</firstname>
<lastname>Last name 2</lastname>
</contact>
</contacts>
<invoices>
<invoice>
<date>01/02/03</date>
</invoice>
<invoice>
<date>04/05/06</date>
</invoice>
</invoices>
</company>
</companies> |
...
Columns extracted from the XML file depend on the selected option. See in the table below how the header of the preview table would look like for each option and the number of rows obtained.
companies | company/name | company/contacts/contact/firstname | company/contacts/contact/lastname | 1 |
---|---|---|---|---|
companies/company | name | contacts/firstname | contacts/lastname | 2 |
companies/company/contacts | contact/firstname | contact/lastname | 2 | |
companies/company/contacts/contact | firstname | lastname | 3 |
Backward compatibility
If no option is selected, then by default the first tag found in the root tag is used (“companies/company“ in the example), which is the tag that was automatically used prior to release 104.
...
Consider the above mentioned xml example:
Selected Main entity | Inner entities options |
---|---|
companies/company |
|
companies/company/contacts/contact |
|
For all the inner entities that are not selected, only the first row is included in the data that can be exported. Also note that for technical reasons the columns that belong to the inner entities appear as the last columns. Here is what the preview for the example above would look like depending on each combination of options:
Main entity = companies/company, Inner entities = contacts
name | invoices/invoice/date | contacts/contact/firstname | contacts/contact/lastname | contacts/contact/phones/phone |
---|---|---|---|---|
Company 1 | 01/02/03 | First name 1 | Last name 1 | +123 |
Company 1 | 01/02/03 | First name 2 | Last name 2 |
Main entity = companies/company, Inner entities = invoices
name | contacts/contact/firstname | contacts/contact/lastname | contacts/contact/phones/phone | invoices/invoice/date |
---|---|---|---|---|
Company 1 | First name 1 | Last name 1 | +123 | 01/02/03 |
Company 1 | First name 1 | Last name 1 | +123 | 04/05/06 |
Main entity = companies/company/contacts/contact, Inner entities = phones
firstname | lastname | phones/phone |
---|---|---|
First name 1 | Last name 1 | +123 |
First name 1 | Last name 1 | +456 |
First name 2 | Last name 2 |
Backward compatibility
No Inner entity option is selected by default. Existing profiles with an XML file that contains nested collections that used to be ignored will get extra columns in the preview, which doesn’t impact column mapping.
...
Rule 2: The records to be imported can start at any element that contains elements itself.
<company>
<name>…</name>
<address>
<zipcode>…</zipcode>
<city>…</city>
</address>
<contacts>
<contact>
<firstname>...</firstname>
<lastname>...</lastname>
<phones>
<phone>...</phone>
<phone>...</phone>
</phones>
</contact>
</contacts>
</company>
Rule 3: Any name can be used for the elements, but the records must have the same name, with the same case.
<company>
<address>
<zipcode>…</zipcode>
<city>…</city>
</address>
<Address> <!-- name is different from the selected record name, won’t be imported -->
<zipcode>…</zipcode>
<city>…</city>
</Address>
<deliveryaddress> <!-- name is different from the selected record name, won’t be imported -->
<zipcode>…</zipcode>
<city>…</city>
</deliveryaddress>
</company>
Rule 4: Properties are retrieved from the text content of the innermost element. Attributes are ignored as well as text content if the element also contains nested elements.
<companies>
<company id=”ID”>
<name>NAME</name>
<address>
ADDRESS LINE
<zipcode>ZIP</zipcode>
<city>CITY</city>
</address>
</company>
</companies>
Rule 5: All the properties that need to be imported must be present, even empty, in the first record of the file.
<companies>
<company>
<name>…</name>
<VATCode />
</company>
<company>
<name>…</name>
<VATCode>…</VATCode>
<phone>…</phone> <!-- no phone element in first company element, property cannot be mapped -->
</company>
</companies>
Rule 6: Each property needs to appear only once per record. Duplicates will be ignored.
<companies>
<company>
<name>…</name>
<phones>
<phone>…</phone>
<phone>…</phone> <!-- element already appeared, only first one will be imported -->
</phones>
</company>
</companies>
Rule 7: Elements nested directly in the selected record element can be selected as a collection of inner entities.
<companies>
<company>
<name>…</name>
<contacts>
<contact>
<firstname>…</firstname>
<lastname>…</lastname>
<phones> <!-- element is not a direct child of company, cannot select it as inner entity -->
<phone>…</phone>
<phone>…</phone>
</phones>
</contact>
<contact>
<firstname>…</firstname>
<lastname>…</lastname>
</contact>
</contacts>
</company>
</companies>
Rule 8: Elements that contain at least two nested elements with the same name can be selected as inner entity. Only the first record of the sample file needs to follow this rule, actual files to process can contain only one entry in the selected collection of inner entities.
<companies>
<company>
<contacts> <!-- element contains only one direct nested element -->
<contact>
<firstname>…</firstname>
<lastname>…</lastname>
</contact>
</contacts>
</company>
</companies>
Rule 9: Elements that contain nested elements with different names or that directly contain text cannot be selected as a collection of inner entities.
<companies>
<company>
<contacts> <!-- element contains text -->
CONTACTS
<contact>
<firstname>…</firstname>
<lastname>…</lastname>
</contact>
<contact>
<firstname>…</firstname>
<lastname>…</lastname>
</contact>
</contacts>
<phones> <!-- element contains elements with different names -->
<phone>…</phone>
<phone>…</phone>
<mobilephone>…</mobilephone>
</phones>
</company>
</companies>
Rule 10: Nested elements of an element selected as a collection of inner entities can contain nested entities on multiple levels or directly contain text.
<companies>
<company>
<contacts>
<contact>
<firstname>…</firstname>
<lastname>…</lastname>
<address>
<zipcode>…</zipcode>
<city>…</city>
</address>
</contact>
<contact>
<firstname>…</firstname>
<lastname>…</lastname>
</contact>
</contacts>
<phones>
<phone>…</phone>
<phone>…</phone>
</phones>
</company>
</companies>
Rule 11: The collection of inner entities for the first record must contain at least one inner entity in the files to process.
<companies>
<company>
<name>…</name>
<contacts /> <!-- the whole job will fail as the first record does not contain all the expected columns -->
</company>
<company>
<name>…</name>
<contacts>
<contact>
<firstname>…</firstname>
<lastname>…</lastname>
</contact>
</contacts>
</company>
</companies>
...