# Document Exchange

Document Exchange is the common engine used to send and receive documents and data to and from external systems (e-invoicing, archiving, portals, marketplaces, carriers, etc.). Each exchange is described by a **profile** that combines:

- a **format**, i.e. how data is prepared or read (for example a report, the electronic invoice, a specific integration);
- a **transport**, i.e. how data is delivered or retrieved (for example manual download/upload, e-mail, a file system folder, external services).

The available formats and transports depend on the active features. All operations are recorded in a log.


Search for **Document Exchange Profiles** to create and manage profiles.

| Field | Description |
|---|---|
| Code | Profile identifier. |
| Description | Profile description. |
| Exchange Format | Format used to prepare or interpret documents. |
| Exchange Transport | Channel used to send or receive documents. |
| Enabled | Only enabled profiles with both a format and a transport are offered for processing. |

Available actions:

| Action | Description |
|---|---|
| Format Setup | Opens the specific setup of the selected format. |
| Transport Setup | Opens the specific setup of the selected transport. |
| Activity Log | Opens the activity log of the profile. |


1. Open **Document Exchange Profiles** and create a new line.
2. Enter **Code** and **Description**.
3. Choose the **Exchange Format** and **Exchange Transport**.
4. Use **Format Setup** and **Transport Setup** to complete the specific settings.
5. Turn on **Enabled**.


Several lists and cards (for example posted sales invoices and credit memos, posted shipments, posted purchase invoices and credit memos, sales and purchase orders, customers, G/L and customer ledger entries, journals, issued reminders and finance charge memos, price lists, VAT settlements, withholding taxes) offer the **Document Exchange** action.

1. Select one or more documents.
2. Choose the **Document Exchange** action.
3. In the window that opens, choose the operation among those offered by the enabled profiles that apply to the page.
4. Confirm.

If no profile is available for that kind of document, a message is shown. Some operations run immediately, others are queued for later processing. At the end, if there are warnings, errors or queued activities, the **Document Exchange Log** opens automatically showing the lines of the activity just run.

A generic **Document Exchange** page is also available. It lists all operations not tied to specific documents (for example imports) offered by the enabled profiles: choose the operation and confirm with **OK**.


The log opens from the profile's **Activity Log** action or automatically after processing.

| Field | Description |
|---|---|
| Activity Date/Time | When the activity was recorded. |
| User ID | User who ran the operation. |
| Log Type | Information, Warning, Error, Queued, Queue Error or Completed. |
| Log Message | Description of the activity. |
| Parameters | Requested operation. |
| Document No. | Document involved. |
| Error Message | Error encountered. Click the field to view technical details, if any. |

Available actions:

| Action | Description |
|---|---|
| Download Attachment | Downloads the file linked to the line (for example the document sent or received). |
| Process | Immediately processes an activity of type **Queued**, after confirmation. |
| Reset Status | Sets the selected **Queue Error** lines back to **Queued**, clearing the error message, so they can be processed again. |
| Delete | After confirmation, deletes the selected **Queued** or **Queue Error** lines; other lines are not deleted. |


References let you define conversion tables between Business Central codes and those used by the external system. Search for **Document Exchange References**, create a reference with **Code** and **Description**, and use the actions:

- **Tables**: mapping lines starting from a Business Central record;
- **Values**: mapping lines starting from an external value.

| Field | Description |
|---|---|
| Table ID | Business Central table the mapping refers to. |
| Primary Key 1 / Primary Key 2 | Key of the Business Central record. |
| Value Type | Type of external value. |
| Value 1 / Value 2 | Value used by the external system. |
| Source Type | Restricts the mapping to a customer or a vendor. |
| Source No. | Customer or vendor the mapping applies to. |

Deleting a reference also deletes all its lines.


- Queued activities can be processed automatically by a job queue entry set up for the profile.
- When a queued activity is processed successfully, the line becomes **Completed**; on error it becomes **Queue Error** with the related message.
- On some documents (for example sales orders, invoices and credit memos, issued reminders, purchase documents) the **No. E-Mail Sent** field shows how many times the document has been sent by e-mail.