Creating E-Document Templates

In outbound processing, the e-document template maps what data in a NetSuite transaction record will populate which elements in the XML or JSON file that will be generated and sent to customers or vendors.

In inbound processing, the opposite is implemented. The e-document template maps what elements in the received XML file will populate which data fields in the NetSuite transaction record that will be created from the XML file.

Both outbound and inbound e-document templates can be created on the E-Document Templates record. In this record, you can define the name of the e-document template, the e-document package that the template will be applied to, the applicable transaction types for the template, and the template content.

The template content is different for an outbound and inbound transaction. An outbound e-document template should have content in XML or JSON freemarker template, whereas an inbound e-document template will have content as JSON objects for the field mapping.

An e-document template can be used for both outbound and inbound e-documents, given that the right transaction types are selected and the template content for both outbound and inbound are defined. You can create or customize e-document templates for each country you do business in or for certain industries, according to specified standards.

Use FreeMarker to create the template content for both outbound and inbound e-documents. For more information about scriptable templates and FreeMarker, see the following topics:

Or, you can customize the sample outbound and inbound e-document templates included with the Electronic Invoicing SuiteApp.

The sample outbound template is based on the Brazil NF-e standard. It can be downloaded from the File Cabinet in the Sample Templates folder of the SuiteApp in Documents > File Cabinet > SuiteBundles > Bundle 436209. The following table lists the sample e-document templates and details.

File Name

Description

customer_payment_sample.xml

sample outbound e-document template with tags for customer payment

inbound_template_expenses_items_sample.txt

sample inbound e-document template with tags for items and expenses

inbound_template_sample.txt

sample inbound e-document template with tags for items only

NFe_sample.xml

sample outbound e-document template for Brazil

itemfulfillment_sample.xml

sample outbound e-document template with tags for customer and company information, includes PO number and items

vendorbill_sample.xml

sample outbound e-document template with tags for vendor and company information, includes items and expenses

Inbound_VendorCredit_Peppol_template.txt

sample inbound e-document template with item tags to support converting a credit note based PEPPOL Standard XML file into a vendor credit transaction.

To create an e-document template:

  1. Go to Setup > E-Documents > E-Document Templates > New.

  2. In the Name field, enter a name for the template.

  3. (Optional) In the Description field, enter text that describes this template.

  4. In the E-Document Package field, select the e-document package that this template will be associated with.

    For more information, see Creating E-Document Packages.

    Note:

    If the template is for outbound, the e-document package that this template will be included in, must be assigned to corresponding customers or vendors.

  5. (Optional) Select a plug-in implementation in the Digital Signature Plugin Implementation field. The selected plug-in enables you to include a Digital Signature to the e-documents that will be generated using the template. For more information, see Creating a Digital Signature Plug-in Implementation for E-Documents.

  6. (Optional) Select a plug-in implementation in the Outbound Validation Plug-in Implementation field. The selected plug-in implementation enables you to validate the outbound e-document generation process. For more information, see Creating an Outbound Validation Plug-in Implementation for E-Documents.

  7. (Optional) Select a plug-in implementation in the Custom Data Source Plugin Implementation field. The selected plug-in enables you to include a custom data source in the template for adding more field values to e-documents that will be generated using the template. For more information, see Creating a Custom Plug-in Implementation for E-Document Custom Data Source.

  8. In the Transaction Type field, select one or more transaction types for which this template will be used. To select multiple transaction types, press and hold the Ctrl key while selecting the transaction types.

    Note:

    Make sure that you select the right transaction type that match the template you are creating. If you are creating an outbound template, you must select transaction types that are applicable to outbound processing. See Transactions and Processes Supported by the Electronic Invoicing SuiteApp to know which transaction types you can select.

    Selecting a transaction type for either outbound or inbound will make its corresponding Template Content field required. For example, if you select the outbound transaction type Invoice, the Template for Outbound E-Documents field will be required. On the other hand, if you select bill or bill credit, which is an inbound transaction type, the JSON Field Mapping for Inbound E-Documents field will be required.

    The selected transaction types cannot be modified after the template has been used in a transaction. You must remove the e-document template from the transaction before you can modify this field.

  9. (For an outbound template) In the Subsidiary field, select the subsidiaries that you want to associate with this template. To select multiple subsidiaries, press and hold the Ctrl key while selecting the subsidiaries.

    If only this template is associated with a subsidiary, the supported transactions of that subsidiary will display this template on the E-Document Template field on the E-Document subtab. For more information, see Multi-subsidiary Support in the Outbound Process.

  10. In the Restrict Editing of Transactions with E-document Status field, select any of the following e-document statuses:

    • Sent

    • Sending

    • Ready for Sending

    • Certification in Progress

    To select multiple e-document statuses, press and hold the Ctrl key while selecting the statuses. Transactions with the selected e-document status will be locked for editing if this template is associated with them. Those transactions will display a banner message indicating that the transaction cannot be edited. Editing is only locked on the user interface, transactions can still be edited through script.

  11. Under the Template Content section, do the following:

    • For outbound processing, select XML or JSON format from the Content Type field of the e-document for which the template is generated.

    • If you selected transaction types for outbound processing, enter the XML or JSON content of the outbound e-document template in the Template for Outbound E-Documents field.

    • If you selected transaction types for inbound processing, enter JSON content in the Field Mapping for Inbound E-Documents field. For more information about the inbound e-document template in JSON format, see Understanding Inbound E-Document Templates in JSON Format.

      If the template record you are creating is for both outbound and inbound transaction types, make sure that you enter content in both Template for Outbound E-Documents, and Field Mapping for Inbound E-Documents fields. Otherwise, error messages will be displayed when you save the template record.

  12. Create an XSD file to enable the system to automatically assign the right template to a received XML file after validating required tags and attributes in the XML document. Then, upload the XSD file you created to the File Cabinet. For more information and a sample of the XSD file, refer to Understanding XSD in Inbound E-Document Templates.

  13. Return to the E-Documents Templates page, and under Template Content, select the XSD file you created from the Inbound XSD File dropdown field.

  14. Create an XSD file to enable the system to validate required tags and attributes in the generated XML e-document. Then, upload the XSD file you created to the File Cabinet. For more information and a sample of the XSD file, refer to Understanding XSD in Outbound E-Document Templates.

  15. Return to the E-Documents Templates page, and under Template Content, select the XSD file you created from the Outbound XSD File dropdown field.

  16. Enter the folder ID or folder path of a File Cabinet in the XSD Folder field. The folder contains the XSD files imported by the outbound XSD file.

  17. (Optional) Add path and regex validation expressions to use for validating the template.

    There is no need to add node() at the end to get the value.

    See XPath and Regex Examples for E-Document Templates.

  18. Click Save.

After creating the e-document template, you can include it in an e-document package, which is then assigned to a customer or vendor. See Creating E-Document Packages

Related Topics

Electronic Invoicing Administrator Guide
Installing and Setting Up Electronic Invoicing
Defining the E-Document Country for Free Use
Advanced PDF/HTML Template
Granting Access Permission to the E-Documents Portlet
Understanding E-Documents and E-Document Packages
Creating E-Document Packages
Multi-subsidiary Support in the Outbound Process
Editing E-Document Templates
E-Document Certification in the Outbound Process
E-Document Network Status Overview
Creating E-Document Sending Methods
E-Document Email Custom Templates
Selecting a Designated E-Document Sender
Setting Up Custom Roles to Send E-Documents
Customizing Roles to Restrict E-Document Generation or Sending
Deploying the Bulk Generation Script for E-Documents
Deploying the Script for Scheduled Sending of E-Documents
Scheduled Script for Getting Network Status of E-Documents
Updating E-Document Certification Statuses
Processing E-Documents Automatically for Individual Transactions
Electronic Invoicing Inbound Email Capture
Using SOAP Web Services for Inbound Processing
Setting Up Custom Roles that can Convert Inbound E-Documents
Inbound Validation Plug-ins
Deploying Automatic Bulk Conversion Script for Inbound E-Documents

Related Topics

Electronic Invoicing Administrator Guide
Installing and Setting Up Electronic Invoicing
Defining the E-Document Country for Free Use
Advanced PDF/HTML Template
Granting Access Permission to the E-Documents Portlet
Understanding E-Documents and E-Document Packages
Creating E-Document Packages
Multi-subsidiary Support in the Outbound Process
Editing E-Document Templates
E-Document Certification in the Outbound Process
E-Document Network Status Overview
Creating E-Document Sending Methods
E-Document Email Custom Templates
Selecting a Designated E-Document Sender
Setting Up Custom Roles to Send E-Documents
Customizing Roles to Restrict E-Document Generation or Sending
Deploying the Bulk Generation Script for E-Documents
Deploying the Script for Scheduled Sending of E-Documents
Scheduled Script for Getting Network Status of E-Documents
Updating E-Document Certification Statuses
Processing E-Documents Automatically for Individual Transactions
Electronic Invoicing Inbound Email Capture
Using SOAP Web Services for Inbound Processing
Setting Up Custom Roles that can Convert Inbound E-Documents
Inbound Validation Plug-ins
Deploying Automatic Bulk Conversion Script for Inbound E-Documents

General Notices