Download & Install Sample

Already running RSSBus Connect? This sample will setup RSSBus Connect with the data and port configurations referenced in this article:

  Download Sample
  Sample Installation Info

Insert a Sales Order into NetSuite Based on HTML Form Data

End-to-end integration is an important component of any EDI implementation. The real power of EDI can only be realized when data flows seamlessly from application to partner application, automating important business processes. There are times when a trading partner does not have knowledge of or access to EDI resources. In these cases, it makes sense to allow trading partners to use Web applications and forms to submit business documents like sales orders.

This article provides a walk-through of processing data from a basic sales order HTML form and inserting a new sales order into NetSuite.

Setting up the Sample

To begin, download and install the RSSBus Connect application (free 30-day trial). Then download the sample project and extract and copy the contents to the "data" and "www" folder in the installation location for RSSBus Connect. For Windows installations, this will likely be C:\Program Files\RSSBus\RSSBus Connect. Please consult the documentation for the Java build of RSSBus Connect for Linux/Unix/Mac installations.

Connecting to NetSuite

With the sample installed, the next step is to configure your connection to NetSuite. In RSSBus Connect, navigate to the NetSuite port (NETSUITE) and enter the Account Id, User, and Password on the Settings tab. Additionally, you will need to configure extra properties on the Advanced tab. See below:

  • Include Child Tables (Authentication): Set this property to True.
  • Use Sessions (Authentication): Set this property to False to prevent the driver from creating lingering NetSuite sessions.
  • Aggregate Column Mode (Misc): Set this property to List in order to properly insert items in the Sales Order.
For information on configuring the connection to NetSuite, refer to the online Help documentation for the port.

You can review the Input template on the NetSuite port to ensure that it is properly configured. Scroll down on the Settings tab for the NETSUITE port and look for the Input Templates. To review (and edit) the SalesOrder template, click on SalesOrder.

Configure the Mapping

You can also review the mapping and script by navigating to the HTML_TO_NS port (a Map port). You'll note that the Source and Destination files are pre-configured. For the source, we used a sample XML document that represents the XML created by our HTML form. For the destination file, we used the SalesOrder input template from the NETSUITE port. To map the values from the HTML form to a the SalesOrder template, we used RSB scripting. For more information on RSB scripting, refer to our online Help documentation. You can see the full script below:

<rsb:call op='xmlDOMSearch?xpath=SalesOrder'>
      <rsb:call op='xmlDOMSearch?xpath=SalesOrderLineItem'>

NOTE: Part of the scripting is XML-encoded twice (i.e.: &amp;lt; for <). This is to ensure that the sales order line item aggregate is properly XML-encoded before it is sent to NetSuite.

Entering a Sales Order

If you have not already, place the salesOrder.rst file from the sample in the www folder at the installation directory for RSSBus Connect.

Using the HTML Form

The included HTML form (salesOrder.rst) represents a very basic sales order. In it, you can enter information like billing and shipping addresses, line items, and a sales order and related purchase order number.

There are several fields that require specific information from NetSuite:

  • CUSTOMER ID: This is the Internal Entity ID from NetSuite for the customer.
  • ITEM ID: This is the Internal ID as displayed in NetSuite for the line items added to the sales order.

NOTE: While all of the fields in this sales order are all manually entered, a real-world HTML form would use drop down options, auto-complete, or other validations for many of the fields to ensure that proper values are submitted in the form.

Once you've completely filled in the sales order, click to submit the form to RSSBus Connect. This form uses RSB script to save the form data as an XML file to disk. For this article, we save the XML file directly to the Send folder for the HTML_TO_NS Map port, but you can configure where the file is saved in the code for the form. Below is a snippet of salesOrder.rst:

<rsb:script method="POST">
  <!--Build the top level XML data-->
  <rsb:set attr="" value="<SalesOrder>\r\n"/>
  <rsb:enum attr="_request.form:*">
    <rsb:match pattern="form:item*" type="regex" value="[_attr]">
        <rsb:set attr="" value="[]<[_attr|replace('form:','')|capitalize]>[_value]</[_attr|replace('form:','')|capitalize]>\r\n"/>
  <rsb:set attr="" value="[]"/>

  <!--Build the line item level XML data-->
  <rsb:enum attr="_request.form:itemName" expand="true">
    <rsb:set attr="">[]<SalesOrderLineItem>\r\n<itemName>[_request.form:itemName#[_index]]</itemName>\r\n<itemId>[_request.form:itemId#[_index]]</itemId>\r\n<itemDesc>[_request.form:itemDesc#[_index]]</itemDesc>\r\n<itemUnit>[_request.form:itemUnit#[_index]]</itemUnit>\r\n<itemQty>[_request.form:itemQty#[_index]]</itemQty>\r\n<itemAmt>[_request.form:itemAmt#[_index]]</itemAmt>\r\n</SalesOrderLineItem>\r\n</rsb:set>
  <!--Write the XML data to a file on disk-->
  <rsb:set attr="data" value="[]\r\n</SalesOrder>"/>
  <rsb:set attr="file" value="..\data\HTML_TO_NS\Send\SO_[now|date(MMddyy_HHmmss)].xml"/>
  <rsb:call op="fileCreate"/>

Translate a Generic XML Sales Order into an XML Sales Order for NetSuite

The HTML_TO_NS port is a mapping port designed to map the XML from the HTML form to the SalesOrder table from the NETSUITE port. As described above, the port uses RSB script to map the values and build properly formatted XML. The HTML_TO_NS port is configured to automatically translate and send the document to the NETSUITE port. You can configure where to send the translated document using the SendToPort setting on the Settings tab for the HTML_TO_NS port.

Push a Sales Order to NetSuite and Retrieve an Invoice

Now that you have a sales order in the Send folder for the NETSUITE port, you can inject the sales order into NetSuite. To do so, select the appropriate document in the Send folder for the NETSUITE port and click Send.

At this point, you have a new sales order in NetSuite based on the data entered in the HTML form and ready to be processed.

More Information & Next Steps

As you can see, with RSSBus Connect, it is possible to automate your business document exchange and integrate directly with NetSuite. For more information on RSSBus Connect, visit our home page. Download your free, 30-day trial of RSSBus Connect and start controlling your business document exchange today!