Mule Netsuite Connector V11 Part 1

Author: Aman Kumar & Harshal Borade

In our previous article,  we discussed various upgrades in MuleSoft NetSuite connector v11. This article will see how to make XML SOAP requests for v11 connectors and various operations available NetSuite connector v11.

 Before going forward, one has to confirm two things :

  1. In the pom.xml file of the Mule project, check that the NetSuite Connector dependency version is 11. X.x.
  2. Test connection with NetSuite is successful.
NetSuite Operations

GET – This operation retrieves a particular record by providing the internal ID that uniquely identifies a record in NetSuite.

Internal ID – It’s a unique ID assigned to each record by NetSuite.

External ID – Unique ID assigned to each record by the external system like Salesforce.

Use case 1: Getting a customer record from NetSuite

  1. Drag an HTTP listener and set its port and path
  2. A transform message for the XML request
  3. Get operation from NetSuite palette
  4. Transform message to convert XML response to JSON
  5. Request and response loggers to capture logs

Select the connector configuration, Ref type has to be set as “RecordRef,” and type equals to “customer.”

To get the expected SOAP request, we can use debug logs of the v10 mule application.

One will get similar logs for a customer to get a request in NetSuite connector v10. These logs will help to specify the correct namespace and type.

The XML request to get a customer record

1) Both 2020_1 and 2020_2 in the namespace will work. Make sure that the port passed in namespaces is the same as the SOAP port in NetSuite Config.

2) Namespaces are automatically generated using DataSense explorer, but one might need to add some namespaces used in SOAP requests (Debug logs can be referred to get them).

One can test the customer details by hitting the HTTP endpoint.

Use case 2: Getting invoice and cash sale from  NetSuite

This use will get cash sales & invoices from NetSuite and combine them using scatter-gather to obtain cumulative data and store them in a file.

Getting the invoice from NetSuite

Ref type is “RecordRef” and type “invoice.”

Getting cash sale from NetSuite

Ref type is “RecordRef”and type “cashSale”

Merging the response and storing it in a single file

The above two sub-flows will return us an invoice and cash sale. Now we have to merge the data sent by them and store it in a file.

We have used scatter-gather to call both the flows and then convert the XML response to JSON.

The collective response is stored in a text file in our local system.

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.