EDI v2
Reads and writes EDI documents, the standard business documents that companies exchange electronically, such as purchase orders, invoices and delivery notes. The Node turns an EDI document into JSON that you can map in your Workflow, and turns JSON back into an EDI document you can send to a trading partner.
The Node supports the two most common EDI standards: UN/EDIFACT, used widely in Europe and internationally, and X12, used mainly in North America. It checks every document against the rules of its standard, so problems are caught before the data reaches your other systems.
The Node doesn't send or receive files itself. Use a Node such as File, FTP/FTPS, SFTP or Azure Blob Storage to collect and deliver documents.
If a UN/EDIFACT version or an X12 document type you need is not available, contact Flowgear Support to request it. Missing specifications and definitions can be added easily.
Revision History
0.3.0.2 - Initial release.
Connection
Use this Connection to choose the EDI standard and version your trading partner uses. The Connection decides which document types you can pick from when you set up the Node.
| Property | Type | Description |
|---|---|---|
Standard |
Enum | Edifact or X12. Select Any only if you want to identify documents with DiscoverDocument. The default is Edifact. |
Directory Release |
Enum | UN/EDIFACT only. The version of the UN/EDIFACT standard your partner uses, for example D04A or D24A. Available versions are D03A to D06B, D19A to D20B, and D24A. |
Syntax Identifier |
String | UN/EDIFACT only. Optional. Accept only documents that use this character set, for example UNOC. Leave empty to accept any. |
Controlling Agency |
String | UN/EDIFACT only. Optional. Accept only messages from this agency. The default, UN, suits almost all documents. Leave empty to accept any. |
X12 Definitions |
String | X12 only. Required. A description of the X12 document types your partner uses. See X12 Definitions. |
Test the Connection to confirm that the selected version or your X12 Definitions load correctly.
Setup Notes
These terms are used throughout this article:
- Trading partner: a company you exchange EDI documents with, such as a customer or supplier.
- Message type: the kind of business document, such as
ORDERS(a purchase order) orINVOIC(an invoice) in UN/EDIFACT. X12 calls these transaction sets and numbers them, for example850for a purchase order and810for an invoice. - Interchange: one EDI file or transmission. It has a header that names the sender and receiver, and can hold several messages.
To set up the Node:
- If you're not sure which standard or version a partner uses, run
DiscoverDocumenton one of their documents. It tells you whichConnectionsettings to use. - Create an
EDIConnectionand selectStandard. - For UN/EDIFACT, select the
Directory Releaseyour partner uses. - For X12, enter the
X12 Definitionsfor your partner's documents. - Test the
Connection. - Add the Node to your Workflow and select a template for the message type you want to read or write, for example
ORDERS.
UN/EDIFACT versions are included with the Node. X12 standards are owned and licensed by X12 Inc., so they can't be included. Instead, you describe the documents your partner sends in X12 Definitions, based on the implementation guide your partner gives you. Contact Flowgear Support if you need help adding a document type.
To run this Node on a local Runtime Cluster, the Cluster must support .NET 10.
Methods
Each template is for one message type. Templates for reading and writing the same message type have the same structure, so you can map the output of Parse straight into Create.
Parse
Reads an EDI document and returns each message as JSON. Select a template for the message type you expect, for example ORDERS or 850. Every message in the document must be that type.
| Parameter | Type | Description |
|---|---|---|
Connection |
Connection | The EDI Connection to use. |
Document |
Stream | The EDI document to read. |
MessageType |
String | Set by the selected template. |
| Return | Type | Description |
|---|---|---|
Response |
Array | One row for each message in the document. |
Response.Interchange |
Object | Details of the interchange the message came in, such as the sender, receiver, date and control number. |
Response.Message |
Object | The message content, in the structure shown by the template. |
Response.Diagnostics |
Array | Warnings about individual values, such as a code that isn't in the standard's code list. Each warning names the segment and position of the value. |
If a document is badly formed, for example a required section is missing or sections are in the wrong order, the Node stops with an error that says where the problem is. Smaller problems with individual values don't stop the Node. They are listed in Diagnostics so you can decide how to handle them.
Create
Builds an EDI document from JSON. Each item in Items becomes one message in the document.
| Parameter | Type | Description |
|---|---|---|
Connection |
Connection | The EDI Connection to use. Standard must be Edifact or X12. For UN/EDIFACT, select a specific Directory Release. |
Interchange |
Object | The document header. Supply at least Sender.Id and Receiver.Id, plus ControlReference for UN/EDIFACT or ControlNumber for X12. |
Items |
Array | The messages to write, one per item, in the structure shown by the template. |
MessageType |
String | Set by the selected template. |
| Return | Type | Description |
|---|---|---|
Document |
Stream | The EDI document, ready to send to your partner. |
The Node adds the technical parts of the document for you, such as message numbers, counts and the standard's version details. Leave these out of your items. If the date or time is missing, the current UTC date and time are used.
The Node checks the whole document before returning it. If any item doesn't match the template, for example a required field is missing, the Node stops with an error and doesn't return a partial document.
DiscoverDocument
Identifies an EDI document and tells you how to set up a Connection to read it. Use it when you receive a document from a new partner, or to find out which message types a document contains. You don't need a Connection to use this method.
| Parameter | Type | Description |
|---|---|---|
Connection |
Connection | Optional. A Connection to compare with the document. |
Document |
Stream | The EDI document to identify. |
| Return | Type | Description |
|---|---|---|
Response |
Object | What the Node found in the document. |
Response.Standard |
String | EDIFACT or X12. |
Response.Syntax |
Object | Technical details of how the document is formatted. |
Response.Interchanges |
Array | Each interchange in the document, with its sender, receiver, date, and the type and version of every message it contains. |
Response.ConnectionSettings |
Object | The Connection settings to use for this document. |
Response.Mismatches |
Array | Settings in the Connection you supplied that don't match the document. Empty when there are none. |
Usage Notes
- The JSON uses the names from the EDI standard, so it's easy to match against your partner's implementation guide. Open the template to see every field, whether it's required, and the codes it accepts.
- Fields that can appear more than once, such as order lines, are returned as arrays.
- Values are returned as text, exactly as your partner sent them.
- A document can contain up to 100,000 messages.
X12 Definitions
X12 Definitions describes the X12 documents your partner uses, in a JSON format. Each part of the definitions matches part of your partner's implementation guide:
Versionis the X12 version, for example004010.Elementsare the individual fields, with their name, type, length and allowed codes.Segmentsare groups of fields, such as the beginning of a purchase order.TransactionSetsare the document types, such as the850purchase order, and list which segments they contain and in what order.
This example describes part of an 850 purchase order:
{
"Version": "004010",
"Elements": {
"324": { "Name": "Purchase Order Number", "Type": "AN", "MinLength": 1, "MaxLength": 22 },
"353": { "Name": "Transaction Set Purpose Code", "Type": "ID", "MinLength": 2, "MaxLength": 2, "Codes": { "00": "Original" } }
},
"Segments": {
"BEG": { "Name": "Beginning Segment for Purchase Order", "Elements": [ { "Element": "353", "Usage": "M" }, { "Element": "324", "Usage": "M" } ] }
},
"TransactionSets": {
"850": {
"Name": "Purchase Order",
"FunctionalIdentifierCode": "PO",
"Structure": [
{ "Segment": "BEG", "Usage": "M" }
]
}
}
}
Usage is M for mandatory or O for optional. When you test the Connection, any mistake in the definitions is reported with its location. Contact Flowgear Support if you need help writing definitions for your partner's documents.
Examples
Receive orders and send invoices
- Use an
SFTPNode to download an order file from your partner. - Use the
EDINode with anORDERSParsetemplate to read the orders. - Map each
Messageinto your ERP or order system. - Build invoices from your system's data and pass them to the
EDINode with anINVOICCreatetemplate. - Use an
SFTPNode to upload the invoice document to your partner.
Known Issues
- The Node doesn't create acknowledgement documents, such as UN/EDIFACT
CONTRLor X12997and999. - Each
Createcall produces one interchange. - X12 support covers common documents. Some advanced rules, such as fields that are required only when another field is present, aren't checked. Hierarchical documents such as the X12
856ship notice aren't fully supported yet. - Only UN/EDIFACT syntax version 3 with the
UNOA,UNOBandUNOCcharacter sets can be read and created.