Skip to main content

Extensibility (developers)

The eInvoice Sender is built around a small set of AL interfaces so that partners and customers can extend it - add support for new document types, plug in a different reader, or add their own validation rules - without modifying the base app. This page is aimed at developers.

Interface 1 - DXP eInv Doc Exporter

Implement DXP eInv Doc Exporter to build the export payload for a given document type. It has a single method, CreateDocument(DocHeader: Variant): JsonObject - turning one kind of Business Central document into the JSON payload the pipeline serializes and sends to generation.

Implementations are bound through the extensible Export Document enum: add a value for your document type and point it at your implementing codeunit. The pipeline selects the exporter by resolving this enum, so registering a new exporter is a matter of extending it.

Interface 2 - DXP eInv Doc Reader V2

Implement DXP eInv Doc Reader V2 to provide a reader over the CIM (common information model) representation of a document - its ReadDocument method fills the CIM buffers (document, party, line, allowance/charge, payment, attachment) so rules and generation can consume the data uniformly.

The Export Document enum binds both interfaces: each enum value points at an exporter and a reader for that document type. When you add a new document type you provide both.

Interface 3 - DXP eInv IValidation Rule

Implement DXP eInv IValidation Rule to add validation rules. It has two methods: Evaluate (runs the check and appends findings) and GetMetadata (returns the rule's category, default severity, stage, description and fix hint - which is what seeds Rule Setup). A single codeunit can dispatch on the rule id and serve many rules, keeping within the object-ID budget.

Rules are bound through the extensible Validation Rule enum, which provides a dedicated CUSTOM extension point for customer- and partner-supplied rules. Add an enum value bound to your implementing codeunit, and the rule participates in validation like any built-in rule - it appears in Rule Setup where its Enabled flag, severity override and stage can be configured.

The OnCollectValidationRules event

The app publishes the OnCollectValidationRules integration event. Subscribe to it to register your rule implementations with the validation engine at runtime. This is the hook that lets an extending app contribute rules into the collection the pipeline and the live compliance check both use.

Together these three interfaces plus the integration event cover the main extension scenarios: new document type (Doc Exporter + Export Document enum), custom model reading (Doc Reader V2), and custom validation (IValidation Rule + Validation Rule enum, registered via OnCollectValidationRules).