France EI Extension Plug-in
The European Union Electronic Invoicing SuiteApp lets you extend the electronic invoicing functionality for France by creating and implementing a custom plug-in.
For more information, see the following topics:
Extending France Electronic Invoicing Functionality
If you need to extend the existing France Electronic Invoicing functionality in NetSuite, create a custom plug-in implementation and leverage the localization extension service for France.
Overview
The France Electronic Invoicing solution includes an extension service that enables you to reuse standard localization logic and apply custom modifications to E-document content.
Using the France Extension Service
To extend the standard functionality, you must import the France extension service using the exact path below:
/SuiteApps/com.netsuite.euelectronicinvoicing/src/countries/FR/services/FRDocExtensionService.js
This path is fixed and can't be changed.
After importing the service, call the .extend(context) method to retrieve content processed by the SuiteApp. You can modify the content as needed and return it in the content field of the response object.
Example Implementation:
* @NApiVersion 2.1
* @NScriptType plugintypeimpl
* Example: one invoice item and an existing BuyerReference.
* customNode is illustrative; use a valid UBL element in actual implementations.
*/
define([
'N/xml',
'/SuiteApps/com.netsuite.euelectronicinvoicing/src/countries/FR/services/FRDocExtensionService.js'
], function (xml, FRDocExtensionService) {
function extend(context) {
let content = FRDocExtensionService.extend(context);
// Run your own code / functionality here
const transaction = context.transactionRecord;
const headerValue = transaction.getValue({
fieldId: 'custbody_demo_buyer_reference'
});
const lineValue = transaction.getSublistValue({
sublistId: 'item',
fieldId: 'custcol_demo_line_note',
line: 0
});
// Update the existing buyer reference using the custom header field.
const buyerReferenceNode = `<cbc:BuyerReference>${xml.escape({ xmlText: headerValue })}</cbc:BuyerReference>`;
content = content.replace(
/<cbc:BuyerReference>[\s\S]*?<\/cbc:BuyerReference>/,
() => buyerReferenceNode
);
// Create a new node from the custom line field.
const customNode = `<customNode>${xml.escape({ xmlText: lineValue })}</customNode>`;
// Insert it BEFORE the existing quantity node, preserving that node.
content = content.replace(
'<cbc:InvoicedQuantity',
existingQuantityNodeStart => customNode + '\n' + existingQuantityNodeStart
);
return {
success: true,
content: content
};
}
return { extend: extend };
});
This example calls the France extension service to apply standard localization functionality. It then reads two custom text fields from the transaction record in context.transactionRecord:
-
custbody_demo_buyer_reference: A transaction body field that updates the existingcbc:BuyerReferenceelement. -
custcol_demo_line_note: A transaction column field that creates a sample element on the first invoice line.
Before you run the example, create and populate these fields. Alternatively, replace the placeholder field IDs with IDs from your account. No additional query or custom data source modification is required to read these fields.
This example assumes that the invoice has one item and includes the existing cbc:BuyerReference and cbc:InvoicedQuantity elements.
Creating the Plug-in for France
To create your custom plug-in implementation:
-
Go to Customization > Plug-ins > Plug-in Implementations > New.
-
In the Script File field, create a new plug-in implementation using your script.
-
Click Create Plug-in Implementation to save your plug-in.
For more information, see Creating a New Plug-in Implementation.
Template Customization and Extension
EN16931 and FRCTC Extended standards support more data than standard templates expose by default.
Data Model Extension:
-
Create Custom Fields or Records within your NetSuite account to fit your requirements
Template Mapping & Extension:
-
Copy the existing France Template
-
Modify template during the generation of the UBL Document using Outbound Extension Plug-in script
Outbound Extension Plug-in Customization:
-
Extends e-document generation logic
-
Enables to modify XML structure by adding, removing, or updating XML nodes and its sourcing
If you modify the standard France E-Invoice template, any European Union Electronic Invoicing SuiteApp update will revert it back to the default plug-in. If you create your own E-document Package and Template, it won't be affected by the SuiteApp updates. However, it will also not automatically receive future updates to the standard template.
Limitations
Data Limitations:
-
Units of Measure and Payment Means Code are hardcoded with "ZZ" value. Payment Means can be mapped using UMA.
-
Self Billing is not supported.
Related Topics
- France Electronic Invoicing
- Configuring E-document templates for France
- Creating and sending Outbound Transactions for France
- Processing Inbound Transactions for France
- Data in the E-document supported by Electronic Invoicing and Advanced Localization Features
- Sourcing Logic for France E-invoicing Specific Fields
- France E-Reporting