> For the complete documentation index, see [llms.txt](https://docs.dynalogic.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.dynalogic.com/birds-document-warehouse-product-overview/integrations-and-technical-reference/d365-finance-and-operations/output-management.md).

# Output Management

This document provides an overview how to integrate custom reports with the Output Management solution.

## 1. Custom reports development

### 1.1. Supported reports

Hereby an overview of which reports are supported within our Output management solution.

| Report structure                                                                    | Data provider / table type            | Support                                   |
| ----------------------------------------------------------------------------------- | ------------------------------------- | ----------------------------------------- |
| Without a report contract                                                           | Not applicable                        | **Unsupported**                           |
| With a report contract, without a report data provider (DP class)                   | Query as data source                  | **Supported**                             |
| With a report contract, a data provider, and a journal & transaction structure      | ReportDataProviderBase / InMemory     | **Supported**                             |
| With a report contract, a data provider, and a journal & transaction structure      | ReportDataProviderPreProcess / Normal | **Supported**                             |
| With a report contract, a data provider, and a journal & transaction structure      | ReportDataProviderTempDB / TempDB     | **Supported**                             |
| With a report contract and data provider, without a journal & transaction structure | ReportDataProviderBase / InMemory     | **Supported**, with the limitations below |
| With a report contract and data provider, without a journal & transaction structure | ReportDataProviderPreProcess / Normal | **Supported**, with the limitations below |
| With a report contract and data provider, without a journal & transaction structure | ReportDataProviderTempDB / TempDB     | **Supported**, with the limitations below |

Commercial documents such as sales order confirmations, sales invoices, and purchase order confirmations use a journal & transaction structure. Many non-commercial documents, such as HR and production reports, are not related to posting and do not use that structure.

{% hint style="warning" %}
Reports without a journal & transaction structure have no automatic archiving and no document title / proforma information. To use these advantages, check chapter 3.2.
{% endhint %}

### 1.2. Delegates

#### 1.2.1 How to pass the document title and the record Id information?

* Create a data contract with as DataContractAttribute as attribute
* Make sure two parm methods exists in your data contract
  * parmRecordId
  * parmDocumentTitle
* Create an event handler (or copy the original method from EXAPrintReportRecordSelector class – method getFromContractDelegate)

```
/// <summary>
/// To pass the values to the event and retrieve the record Id of the header and the document title but not necessary
/// </summary>
/// <param name="_dataContract">the current data contract</param>
/// <param name="_result"> Object of type EventHandlerResult with a container with a RecId and a documentTitle values</param>
[SubscribesTo(classStr(EXAPrintReportRecordSelector), delegateStr(EXAPrintReportRecordSelector, getFromContractDelegate))]
public static void EXAPrintReportRecordSelector_getFromContractDelegate(Object _dataContract, EventHandlerResult _result)
{
RecId           recId;
        str             documentTitle;
        ;
        if(_dataContract is EXAReportExampleDataContract)
        {
            EXAReportExampleDataContract dataContract = _dataContract;
            recId           =   dataContract.parmRecordId();
            documentTitle   =   dataContract.parmDocumentTitle();
        }

        if(_result.hasResult() == false
           && (documentTitle != '' || recId != 0))
        {
           _result.result([recId, documentTitle]);
        }
}
```

#### 1.2.2 How to pass the proforma information?

You need to validate if the common object can be converted to your table.\
Via this function, you can decide if it’s a proforma or an effective posting.

```
/// <summary>
/// To pass proforma information from your custom report datasource to Ex Arte Raptor Output Management
/// </summary>
/// <param name="_common">the linked record</param>
/// <param name="_result">Object of type EventHandlerResult with a boolean as result</param>
[SubscribesTo(classStr(EXAPrintReportRecordSelector), delegateStr(EXAPrintReportRecordSelector, getProformaFromRecord))]
public static void EXAPrintReportRecordSelector_getProformaFromRecord(Common _common, EventHandlerResult _result)
{
        // Do something with the _common object and convert to your table
        // Pass the proforma information to the object _result of type EventHandlerResult
        // We expect a boolean as result value, make sure to verify if this is filled in another event already or not.

        boolean setupFound, isJournalProforma;

        switch(_common.TableId)
        {
           //In this example, we make sure to pass proforma information for WHSLoadTable
            case tableNum(WHSLoadTable):
                setupFound = true;
                isJournalProforma = false;
                break;
        }

        if(_result.hasResult() == false && setupFound == true)
        {
            _result.result([isJournalProforma]);
        }
}
```

## 2. Business event integration

The Output management solution has one business event that can be triggered when an Ex Arte print destination is chosen during generation of a document. Please keep In mind the current schema can be extended with extra fields If possible but It's Important the payload should be small.

The current schema include these fields for the integration:

| Payload field        | Source or meaning                                                                                                                     |
| -------------------- | ------------------------------------------------------------------------------------------------------------------------------------- |
| Filename             | Generated filename of the document.                                                                                                   |
| DocumentTemplate     | Table EXAReportSetup, field DocumentTemplate.                                                                                         |
| TableNamePrimary     | Table EXAReportSetup, field PrimaryTableName.                                                                                         |
| ReportSetupId        | Table EXAReportSetup, field ReportSetupId.                                                                                            |
| ReportName           | Table EXAReportSetup, field ReportName.                                                                                               |
| ReportRefLegalEntity | Table EXAReportSetup, field RefCompanyId.                                                                                             |
| ReportProvider       | Table EXAReportSetup, field Provider. Enum symbols: SSRS, dox42, SmartFlows, Electronic Reporting.                                    |
| TableName            | Table name behind the linked record.                                                                                                  |
| RecId                | Record Id behind the linked record.                                                                                                   |
| PrintMediumType      | Selected print destination. Enum symbols: Ex Arte Archive, Ex Arte Screen, Ex Arte Printer, Ex Arte Email, Ex Arte Email interactive. |
| LegalEntity          | Current legal entity where the report is generated.                                                                                   |

## 3. Email distribution framework

It's recommend to read the functional part before starting with this chapter. This chapter only includes technical instructions regarding how to extend the email distribution framework. Also, the Important enumerations are extensible as well.

### 3.1. Data structure

#### 3.1.1 Events

* Base enumerations
  * Sender type: EXAEmailDistributionSenderType
  * Recipient type: EXAEmailDistributionRecipientType
  * Event type: EXAEmailDistributionEventType
* Table relations
  * Recipient relation: enforce It with a table relation In table extension

<figure><img src="https://1567270722-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FbMdBZV3cNP56k0aYYCI6%2Fuploads%2Fgit-blob-30d0364bfa4f3442188da999743498746f6d9be5%2Fimage%20(693).png?alt=media" alt=""><figcaption></figcaption></figure>

#### 3.1.1. Event groups

Create an event group In your table (CustTable, VendTable, SalesTable, …) based upon extended data type EXAEmailDistributionEventGroupId and create a foreign key relation to table EXAEmailDistributionEventGroup.

### 3.2. Business logic

#### 3.2.1 Class based upon a new event type

This is a class based upon a new event type based upon attribute EXAEmailDistributionEventHandlerAttribute. Important is to mention the right event type that you've created earlier. Add new methods to execute extra logic if possible.

<figure><img src="https://1567270722-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FbMdBZV3cNP56k0aYYCI6%2Fuploads%2Fgit-blob-dce4cdbf280a51598bf67c748e00775258a8b5f5%2Fimage%20(694).png?alt=media" alt=""><figcaption></figcaption></figure>

#### 3.2.2 Code snippet to trigger a specific event type in combination with an event group

1. Create an object of type EXAEmailDistributionEventHandlerContract to provide a common record like SalesTable, an event type and a dirPartyRecid as optional parameter.
2. Call the event handler class with the created contract and trigger a specific event group.

<figure><img src="https://1567270722-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FbMdBZV3cNP56k0aYYCI6%2Fuploads%2Fgit-blob-04fcfa14c70a1960fea48a25bc3c2134ee129ee1%2Fimage%20(695).png?alt=media" alt=""><figcaption></figcaption></figure>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.dynalogic.com/birds-document-warehouse-product-overview/integrations-and-technical-reference/d365-finance-and-operations/output-management.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
