Customizing X12 EDI in MuleSoft

Author: Hunny Bhartiya

EDI standards (Electronic Data Interchange) are the specific guidelines that define the format of B2B documents such as orders, inventories, and invoices. These formats are predefined either by X12 or EDIFACT standards. 

While working on certain projects, there could be some scenarios where the schema defined by the X12 standard needs to be customized or changed to fit the business requirement. Although MuleSoft provides an X12 connector to read or write to an EDI file, it does not have any special configuration using which you can customize the esl (EDI schema) file.

Let us consider an example of EDI (v004010) 940 warehouse shipping order in which we would need to change an element’s the length/dataType/usage etc to suit our business requirements.

  1. After adding the X12 component and its dependency in your project, copy the basedefs.esl and 940.esl from the path as shown below. 

(In our example we are dealing with the 940 format. You will need to copy the esl file for the format which you need to change. Also, In our case, the version of EDI is 004010, hence we need to copy the file from that folder.)

 

2. Paste both the files in the resources folder.

3. Change the path of basedefs.esl in the copied 940.esl file as below.

4.  Update the X12 EDI configuration to refer to the copied 940.esl file

5. Now, let us consider that the element at PER01 needs to be made “Mandatory” instead of   “Optional” as below.

6. Search for the IdRef “PER” in the copied basedef.esl and change the first element’s “usage” to “M” (mandatory).

7. Now, let us suppose, you also want to change the length or data type for this sub element   PER01. In that case, the first search for the term “elements” in the copied basedef.esl

8. Now, below the elements keyword, make a search for the idRef of the sub element (366 in our case) and change the length, type, etc and save.

Similarly, all the elements can be customized in the basedefs file.

We use cookies on this site to enhance your user experience. For a complete overview of how we use cookies, please see our privacy policy.