Why do you need this change?
This would allow extensions to safely add:
- additional
CodiceArticolo values;
- typed
AltriDatiGestionali;
- other valid future FatturaPA line-level elements;
without:
- duplicating the full FatturaPA serializer;
- post-processing the entire generated XML;
- replacing standard Microsoft behavior.
It would also make these customizations much more upgrade-safe and compatible with Business Central SaaS.
Describe the request
We would like to request an additional extensibility point in the Italian FatturaPA export logic, specifically while codeunit 12179 "Export FatturaPA Document" is generating each DettaglioLinee node.
At the moment, PopulateLineData() builds the complete XML representation of a FatturaPA document line, including elements such as:
NumeroLinea
CodiceArticolo
Descrizione
- quantity / unit price
- discounts
- VAT information
AltriDatiGestionali
However, PopulateLineData() is local and there is currently no integration event that allows an extension to append additional valid XML elements to the current DettaglioLinee node.
This limits scenarios where an extension needs to add valid FatturaPA line metadata without replacing or post-processing the complete XML document.
Use case
We are implementing additional FatturaPA functionality in a Business Central SaaS extension.
Examples include:
- Adding an additional
CodiceArticolo containing the internal Business Central Item No., while keeping the standard GTIN mapping.
Example:
<CodiceArticolo>
<CodiceTipo>INTERNO</CodiceTipo>
<CodiceValore>ITEM-001</CodiceValore>
</CodiceArticolo>
- Adding typed
AltriDatiGestionali records associated with a sales line.
For example:
<AltriDatiGestionali>
<TipoDato>LOTTO</TipoDato>
<RiferimentoTesto>A19</RiferimentoTesto>
</AltriDatiGestionali>
or:
<AltriDatiGestionali>
<TipoDato>PESO</TipoDato>
<RiferimentoNumero>12.50</RiferimentoNumero>
</AltriDatiGestionali>
or:
<AltriDatiGestionali>
<TipoDato>DATA</TipoDato>
<RiferimentoData>2026-08-07</RiferimentoData>
</AltriDatiGestionali>
The existing extended-text extensibility in Fattura Doc. Helper is useful for textual content, but it is not sufficient for this scenario because AltriDatiGestionali supports different typed elements such as RiferimentoTesto, RiferimentoNumero, and RiferimentoData.
Requested extensibility point
A simple additive integration event raised near the end of PopulateLineData(), after the standard Microsoft fields have been written but before the current DettaglioLinee XML node is closed, would solve this cleanly.
For example:
[IntegrationEvent(false, false)]
local procedure OnPopulateLineDataBeforeCloseLine(
var TempFatturaLine: Record "Fattura Line" temporary;
var TempXMLBuffer: Record "XML Buffer" temporary)
begin
end;
Conceptually:
local procedure PopulateLineData(...)
begin
TempXMLBuffer.AddGroupElement('DettaglioLinee');
// Standard Microsoft serialization
// NumeroLinea
// CodiceArticolo
// Descrizione
// Quantita
// PrezzoUnitario
// ScontoMaggiorazione
// PrezzoTotale
// AliquotaIVA
// Natura
// existing AltriDatiGestionali
OnPopulateLineDataBeforeCloseLine(
TempFatturaLine,
TempXMLBuffer);
TempXMLBuffer.GetParent();
end;
We do not require an IsHandled parameter because the goal is not to replace Microsoft's standard line serialization. We only need the ability to append additional schema-valid child elements to the existing DettaglioLinee.
Additional clarification: why the event must be raised per line
The requested event needs to run once for each exported DettaglioLinee because the extension data is associated with a specific invoice line and must be written as child elements of that same DettaglioLinee XML node.
For example, an invoice can contain:
Line 1 - Item A
Internal Item No. = ITEM-A
LOTTO = A19
Line 2 - Item B
Internal Item No. = ITEM-B
PESO = 12.50
The required XML is therefore structurally line-specific:
<DettaglioLinee>
<NumeroLinea>1</NumeroLinea>
<CodiceArticolo>
<CodiceTipo>INTERNO</CodiceTipo>
<CodiceValore>ITEM-A</CodiceValore>
</CodiceArticolo>
<AltriDatiGestionali>
<TipoDato>LOTTO</TipoDato>
<RiferimentoTesto>A19</RiferimentoTesto>
</AltriDatiGestionali>
</DettaglioLinee>
<DettaglioLinee>
<NumeroLinea>2</NumeroLinea>
<CodiceArticolo>
<CodiceTipo>INTERNO</CodiceTipo>
<CodiceValore>ITEM-B</CodiceValore>
</CodiceArticolo>
<AltriDatiGestionali>
<TipoDato>PESO</TipoDato>
<RiferimentoNumero>12.50</RiferimentoNumero>
</AltriDatiGestionali>
</DettaglioLinee>
The extension therefore needs both:
- the current
Fattura Line, so it can identify which source/document line is being serialized;
- the current
XML Buffer while that line's DettaglioLinee element is still open.
Why an event before the line loop is not sufficient
An event before the loop would run before any individual DettaglioLinee node has been created.
At that point the extension could potentially inspect the complete temporary Fattura Line dataset, but it could not append XML elements to the corresponding line because there is no current DettaglioLinee XML node yet.
The extension would therefore have to duplicate Microsoft's complete line serialization loop in order to create and associate the custom nodes correctly, which is exactly what this extensibility request is intended to avoid.
Why an event after the line loop is not sufficient
An event after the loop would run after all DettaglioLinee elements have already been generated and closed.
The extension would then need to:
- navigate or search the completed
XML Buffer;
- identify the correct
DettaglioLinee node for each source Fattura Line;
- reopen or manipulate that part of the XML tree;
- insert the additional nodes in the correct schema position.
This is significantly more fragile than adding the nodes while Microsoft is already serializing the corresponding line.
It also creates additional coupling to:
- the internal structure of
XML Buffer;
- how Microsoft numbers or identifies line elements;
- the exact order in which the FatturaPA document is generated.
A per-line event avoids this entirely because the extension is invoked at the point where Microsoft already knows the current line and already has the correct DettaglioLinee node open.
Why this is preferable to replacing the line serialization
The requested event is intentionally additive and does not require IsHandled.
Microsoft would continue to own all standard serialization logic.
The extension would only append additional schema-valid children for the current line, for example additional CodiceArticolo or typed AltriDatiGestionali.
This keeps the customization:
- upgrade-safe;
- compatible with standard Microsoft output;
- limited to the specific additional data required by the extension.
For this reason, raising the event once per exported DettaglioLinee, immediately before the current line element is closed, is the narrowest and least invasive extensibility point for this scenario.
Environment
- Business Central Cloud / SaaS
- Italian localization
- Version 28.x
Thank you for considering this extensibility request.
Internal work item: AB#646226
Why do you need this change?
This would allow extensions to safely add:
CodiceArticolovalues;AltriDatiGestionali;without:
It would also make these customizations much more upgrade-safe and compatible with Business Central SaaS.
Describe the request
We would like to request an additional extensibility point in the Italian FatturaPA export logic, specifically while codeunit
12179 "Export FatturaPA Document"is generating eachDettaglioLineenode.At the moment,
PopulateLineData()builds the complete XML representation of a FatturaPA document line, including elements such as:NumeroLineaCodiceArticoloDescrizioneAltriDatiGestionaliHowever,
PopulateLineData()is local and there is currently no integration event that allows an extension to append additional valid XML elements to the currentDettaglioLineenode.This limits scenarios where an extension needs to add valid FatturaPA line metadata without replacing or post-processing the complete XML document.
Use case
We are implementing additional FatturaPA functionality in a Business Central SaaS extension.
Examples include:
CodiceArticolocontaining the internal Business Central Item No., while keeping the standard GTIN mapping.Example:
AltriDatiGestionalirecords associated with a sales line.For example:
or:
or:
The existing extended-text extensibility in
Fattura Doc. Helperis useful for textual content, but it is not sufficient for this scenario becauseAltriDatiGestionalisupports different typed elements such asRiferimentoTesto,RiferimentoNumero, andRiferimentoData.Requested extensibility point
A simple additive integration event raised near the end of
PopulateLineData(), after the standard Microsoft fields have been written but before the currentDettaglioLineeXML node is closed, would solve this cleanly.For example:
Conceptually:
We do not require an
IsHandledparameter because the goal is not to replace Microsoft's standard line serialization. We only need the ability to append additional schema-valid child elements to the existingDettaglioLinee.Additional clarification: why the event must be raised per line
The requested event needs to run once for each exported
DettaglioLineebecause the extension data is associated with a specific invoice line and must be written as child elements of that sameDettaglioLineeXML node.For example, an invoice can contain:
The required XML is therefore structurally line-specific:
The extension therefore needs both:
Fattura Line, so it can identify which source/document line is being serialized;XML Bufferwhile that line'sDettaglioLineeelement is still open.Why an event before the line loop is not sufficient
An event before the loop would run before any individual
DettaglioLineenode has been created.At that point the extension could potentially inspect the complete temporary Fattura Line dataset, but it could not append XML elements to the corresponding line because there is no current
DettaglioLineeXML node yet.The extension would therefore have to duplicate Microsoft's complete line serialization loop in order to create and associate the custom nodes correctly, which is exactly what this extensibility request is intended to avoid.
Why an event after the line loop is not sufficient
An event after the loop would run after all
DettaglioLineeelements have already been generated and closed.The extension would then need to:
XML Buffer;DettaglioLineenode for each source Fattura Line;This is significantly more fragile than adding the nodes while Microsoft is already serializing the corresponding line.
It also creates additional coupling to:
XML Buffer;A per-line event avoids this entirely because the extension is invoked at the point where Microsoft already knows the current line and already has the correct
DettaglioLineenode open.Why this is preferable to replacing the line serialization
The requested event is intentionally additive and does not require
IsHandled.Microsoft would continue to own all standard serialization logic.
The extension would only append additional schema-valid children for the current line, for example additional
CodiceArticoloor typedAltriDatiGestionali.This keeps the customization:
For this reason, raising the event once per exported
DettaglioLinee, immediately before the current line element is closed, is the narrowest and least invasive extensibility point for this scenario.Environment
Thank you for considering this extensibility request.
Internal work item: AB#646226