Skip to content

Examples

This section provides examples of using solution extensibility.

Add a field into the sales invoice line

This example add a field into the sales invoice line to fill a node in the XML file.

Description

The customer Cronus has the need to fill the Issuer contract reference in the sales invoice line when generate eht XML to Spain public administration.

This field is optional in the field definition of the format Facturae (Fields definition) and the solution do not fill the field automatically.

Reference to field: 3.1.6.1.1. IssuerContractReference.

Detail

This section details the steps to be taken to meet the customers needs:

  • Create the extension
  • Extends the INNESGFeLines
  • Extends the page INNESGFeLines
  • Use the subscriber OnBeforeInsertLines
  • Use the subscriber OnAfterSetInvoiceLine

Create the extension

A new extension must be created that has the following dependency in the app.json file:

  • Id: a61e36f0-17a0-4f2f-8554-de7a0dc7b870
  • Name: eSign Facturae
  • Publisher: Innova Advanced Consulting
  • Version: X.X.X.X

ExtensionDependency

Warning

The extension information can be viewed in the system extensions. Use the version that is installed in the dependency.

By downloading the symbols, you will have the possibility to extend the tables and use the subscribers.

Extends the table INNESGFeLines

The table INNESGFeLines has the information to generate the invoice lines into the XML file.

We need generate an extension to the table and add the field IssuerContractReference with type Text[20]. It will be necessary to use a prefix in the field to comply with the AppSources policy.

ExtensionTableFeLines

Extends the page INNESGFeLines

The page INNESGFeLines show the information of invoices line.

We need generate an extension to the page and add the field IssuerContractReference.

ExtensionPageFeLines

Use the subscriber OnBeforeInsertLines

We need use the subscriber OnBeforeInsertLines once create the field to fill it. The subscriber it is available in the codeunit INNESGFePublishers.

We can create a codeunit to add the subscribers, although it could be added in an object already created.

ExtensionSuscriptorInsertLine

Warning

The example uses a test text to fill in the field, although any field in the table could be used, custom or not.

We need fill the field in the lines when the Facturae document (Facturae document) is generated.

ExtensionSuscriptorInsertLinePage

Use the subscriber OnAfterSetInvoiceLine

We need use the subscriber OnAfterSetInvoiceLine to fill the node in XML once the field is filled throught the subscriber OnBeforeInsertLines.

We can create a codeunit to add the subscribers, although it could be added in an object already created.

ExtensionSuscriptorSetInvoiceLine

The node IssuerContractReference will be into the node InvoiceLine when the XML is generated.

ExtensionSuscriptorSetInvoiceLineXml

Warning

In the example we must fill the field IssuerContractReference of node InvoiceLine and the regulations says than this node must go in the position 3.1.6.1.1. For this reason, a check is made to see if there are other nodes that are later than this node (such as the node 3.1.6.1.11 SequenceNumber), and thus add it before.

Languages

This document is available in these languages: