> 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/input-management.md).

# Input Management

This document provides a technical overview regarding the Input Management solution.With this documentation it should be possible to create new rules and how to integrate the module with other externa

## 1. Invoice setup rule engine

### 1.1. Base objects

All base objects will be described in this chapter to give you an idea which objects should be changed or extended for custom rules.

* Base enum **EXAPurchInvoiceActionStrategy** (is extensible)
* Class **EXAPurchInvoiceStrategyField** : to handle UI actions like lookup in the Invoice Setup form
* Class **EXAPurchInvoiceStrategy** : to execute custom logic based upon the defined strategy

It’s important that every rule have two classes for the UI actions and executing custom logic.

### 1.2. Use EXAPurchInvoiceStrategyField

The base object EXAPurchInvoiceStrategyField is a way to handle the UI actions in the Invoice Setup form. With this class you can bind a field from the table EXAPurchInvoiceImported with a specific class. You can find a list with all possibilities below.

* Bind a field from table EXAPurchInvoiceImported
* Bind the field with a base extended data type (if you want use standard lookup)
* Define which value should be displayed in the Invoice setup form
* Decide or the value can be edited
* Decide or the selected value should be validated
* Use custom lookup

Every child of this base class have an attribute of type EXAPurchInvoiceStrategyFieldAttribute. You can define an enum value in this attribute. Via this way we can bind the enum values with the used classes.

```
[EXAPurchInvoiceStrategyFieldAttribute(EXAPurchInvoiceActionStrategy::SetInvoicePaymentRelease)]
public class EXAPurchInvoiceStrategyField_SetInvoicePaymentRelease extends EXAPurchInvoiceStrategyField
{

}
```

Please look to the existing implementations to give you an idea how to implement this class.

* Custom lookups : **EXAPurchInvoiceStrategyField\_SetJournalName**
* Standard lookups : **EXAPurchInvoiceStrategyField\_SetApprover / EXAPurchInvoiceStrategyField\_SetInvoiceType**
* Empty classes – no specific UI actions : **EXAPurchInvoiceStrategyField\_SetInvoiceData**

### 1.3. Use EXAPurchInvoiceStrategy

This base object EXAPurchInvoiceStrategy is a way to execute custom logic during the import of invoices. It’s possible to update one field in the table EXAPurchInvoiceImported as pre-action so this field can be used to update a LedgerJournalTable record or a VendInvoiceInfoTable record. Also you can write code to have a post-action like as trigger a business event.

```
[EXAPurchInvoiceStrategyAttribute(EXAPurchInvoiceActionStrategy::SetJournalName)]
public class EXAPurchInvoiceStrategy_SetJournalName extends EXAPurchInvoiceStrategy
{

}

```

Please look to the existing implementations to give you an idea how to implement this class.

* Update a field based upon the strategy field : **EXAPurchInvoiceStrategy\_SetApprover**
* Execute custom logic : **EXAPurchInvoiceStrategy\_SetBusinessEvent**

### 1.4. How to start with development

{% stepper %}
{% step %}

### Extend the action strategy enum

Create an extension based upon base enum EXAPurchInvoiceActionStrategy.
{% endstep %}

{% step %}

### Implement the UI behavior

Create a new class based upon EXAPurchInvoiceStrategyField.
{% endstep %}

{% step %}

### Implement the strategy

Create a new class based upon EXAPurchInvoiceStrategy.
{% endstep %}

{% step %}

### Refresh the AOT elements

To be sure, refresh the AOT elements with class EXAPurchInvoiceFlushAOD.
{% endstep %}
{% endstepper %}

## 2. Public endpoints

The existing data entity EXAPurchInvoiceImportedEntity – imported invoice headers entity include public endpoints for external OData integration with external systems. You need to select an existing imported invoice before calling these public endpoints.

| Method                   | Parameters                           | Purpose / result                                                                                                                                         |
| ------------------------ | ------------------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **approvePayment**       | **transDate**, **userId**            | Approve payment for the existing imported invoice. Use an existing userId; if blank, the current user is used.                                           |
| **approvePaymentV2**     | **transDate**, **personnelNumberId** | Same principle as approvePayment, using a personnel number instead of userId.                                                                            |
| **getUrl**               | None                                 | Get the URL to navigate to the existing invoice from an external system.                                                                                 |
| **finishImport**         | None                                 | Notify D365FO that the import of an imported invoice is complete.                                                                                        |
| **checkIfMatchedStatus** | None                                 | Validate whether the pending vendor invoice is matched based on standard D365FO parameters. Returns true if the whole pending vendor invoice is matched. |
| **postInvoice**          | None                                 | Post the existing imported invoice. Returns a boolean true when the invoice is posted.                                                                   |

Example: [https://*d365fo-environment*.cloudax.dynamics.com/data/PurchInvoiceImporteds(DocNo=’XXX’,dataAreaId=’XXX’)/Microsoft.Dynamics.DataEntities.approvePayment](https://d365fo-environment.cloudax.dynamics.com/data/PurchInvoiceImporteds\(DocNo=%E2%80%99XXX%E2%80%99,dataAreaId=%E2%80%99XXX%E2%80%99\)/Microsoft.Dynamics.DataEntities.approvePayment)

{% hint style="info" %}
The following public endpoint is available only in combination with the Process Management solution.
{% endhint %}

| Method            | Parameters | Purpose                                           |
| ----------------- | ---------- | ------------------------------------------------- |
| **cancelProcess** | None       | Cancel the current process of the linked invoice. |

## 3. Custom fields

For the imported invoice header and imported invoice lines we have custom fields. These let integrations save extra values from Ephesoft or Kofax in D365FO without developing extra fields.

Used data entities:

| Data entity                             | Purpose                        | Fields                                |
| --------------------------------------- | ------------------------------ | ------------------------------------- |
| EXAPurchInvoiceImportedFieldsEntity     | Imported invoice header fields | DocNo, FieldName, FieldValue          |
| EXAPurchInvoiceLineImportedFieldsEntity | Imported invoice line fields   | DocNo, LineNum, FieldName, FieldValue |

At this moment we have three supported custom fields for the imported invoice header:

| Custom header field | Use                                                                                                     |
| ------------------- | ------------------------------------------------------------------------------------------------------- |
| STRUCTURED\_PAYMENT | Payment Id for ledger journal transaction lines and pending vendor invoices.                            |
| TRANSACTION\_TXT    | Transaction text for ledger journal transaction lines; invoice description for pending vendor invoices. |
| BUYER\_VAT\_NUMBER  | Buyer VAT number from Kofax, used to execute specific actions in the Invoice rule setup.                |

## 4. Business event integration

The Input Management solution has one business event that can be triggered from the rule engine. For a functional overview regarding the rule engine – you can read the functional documentation about the Input Management solution.

The current schema include these fields for the integration:

| Payload field  | Source                                | Details                                                                 |
| -------------- | ------------------------------------- | ----------------------------------------------------------------------- |
| VendorAccount  | EXAPurchInvoiceImported.VendAccount   | Vendor account                                                          |
| DocumentNumber | EXAPurchInvoiceImported.DocNo         | Document number                                                         |
| InvoiceAmount  | EXAPurchInvoiceImported.InvoiceAmount | Invoice amount                                                          |
| CurrencyCode   | EXAPurchInvoiceImported.CurrencyCode  | Currency code                                                           |
| InvoiceType    | EXAPurchInvoiceImported.InvoiceType   | Enum symbols: None, InvoiceJournal, InvoiceRegister, PendingInvoice     |
| DebitCredit    | EXAPurchInvoiceImported.DebitCredit   | Enum symbols: Debit, Credit                                             |
| InvoiceStatus  | EXAPurchInvoiceImported.InvoiceStatus | Enum symbols: Imported, Posted, Finished, Registered, Matched, Canceled |
| InvoiceId      | EXAPurchInvoiceImported.InvoiceId     | Invoice Id                                                              |
| JournalNum     | LedgerJournalTable.JournalNum         | Relation between imported invoice and ledger journal                    |
| TableRefId     | VendInvoiceInfoTable.TableRefId       | Relation between imported invoice and pending vendor invoice            |
| LegalEntity    | EXAPurchInvoiceImported.DataAreaId    | Legal entity                                                            |

## 5. Power Automate integration

The Input Management solution provide new data entities for the integration between imported invoices and pending vendor invoices. The public collection names are listed in the list below.

### 5.1. Public collection names:

| Public collection           | Content                                                       |
| --------------------------- | ------------------------------------------------------------- |
| EXAVendInvoiceInfoTables    | Pending vendor invoice header                                 |
| EXAVendInvoiceInfoSubTables | Linked purchase orders for a pending vendor invoice           |
| EXAVendInvoiceInfoLines     | Lines of a pending vendor invoice                             |
| EXAVendInvoiceInfoSubLines  | Linked product receipt info for a pending vendor invoice line |

### 5.2. How to execute it with Power Automate?

Get pending vendor invoice

* <https://URL/data/EXAVendInvoiceInfoTables?$filter=TableRefId> eq '010691'\&dataAreaId eq 'frrt'\&cross-company=true

Get purchase orders of a pending vendor invoice

* <https://URL/data/EXAVendInvoiceInfoSubTables?$filter=TableRefId> eq '010691'\&dataAreaId eq 'frrt'\&cross-company=true

Get lines of a pending vendor invoice

* <https://URL/data/EXAVendInvoiceInfoLines?$filter=TableRefId> eq '010691'\&dataAreaId eq 'frrt'\&cross-company=true

Get product receipt info of all lines for a pending vendor invoice

* <https://URL/data/EXAVendInvoiceInfoSubLines?$filter=TableRefId> eq '010691'\&dataAreaId eq 'frrt'\&cross-company=true

The value TableRefId can retrieved on two different ways:

* Get the value TableRefId from the entity EXAPurchInvoiceImporteds (imported invoice headers)
* Get the value TableRefId from the business event contract (chapter 6)

General advice:

Use keyword select so only used fields are retrieved instead of the whole record

* <https://URL/data/EXAVendInvoiceInfoTables?$select=TableRefId&$filter=TableRefId> eq '010691'\&dataAreaId eq 'frrt'\&cross-company=true

## 6. Process management integration

For the AgilePoint NX integration – we will send a list of custom attributes to AgilePoint. Via this way AgilePoint NX can take actions based upon the custom attributes.

Hereby a fixed list with all existing custom attributes:

| Custom attribute         | Meaning                                       |
| ------------------------ | --------------------------------------------- |
| ErpUrl                   | Root URL of your D365FO environment           |
| EntityName               | Entity name of the current record             |
| PublicEntityName         | Public entity name of the current record      |
| PublicCollectionName     | Public collection name of the current record  |
| TableName                | Table name of the current record              |
| RecId                    | RecId value of the current record             |
| RaptorResolveContextJSON | Resolve context object for Document Warehouse |
| ErpUrlEntity             | Full URL for navigating to the current record |


---

# 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/input-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.
