NetSuite AddList Operation through MuleSoft — Part 6

Muneeb Shaik
4 min readMay 31, 2023

--

In our last blog we have seen how to perform Search Operation using NetSuite Connector in MuleSoft by searching Customer record details as an example. In this blog we will see how to perform Insert Operation using the NetSuite AddList Connector in MuleSoft by inserting a list of Customer records as an example.

Business Use-Case:

Let’s assume that there are ’n’ number of records created of same or different record types such as Customer, Item, Order etc., at the source system (It can be a Database, Salesforce etc.,) which needs to be synchronized at NetSuite. Instead of processing record by record using NetSuite Add connector in For-each loop, MuleSoft’s NetSuite AddList connector provides the facility to process all ’n’ number of records within a single request and same records will be created in NetSuite.

AddList Operation:

The addList operation is used to add one or more new instances of a record to NetSuite. If there are multiple records, they can either be of the same record type or different record types. For example, it’s possible to add a customer and a Contact within a single request using this operation. However, each record entered must have a unique signature. Adding two records with the same signature results in a SOAP fault. The signature consists of parameters required to identify a record as unique. For example, in the case of entities, a record is uniquely identified by its name, its type and its parent hierarchy. So you could have two records with the same entityId (or name) belonging to two different record types as follows:

Customer (the type): Mark Wood

MyCompany: Mark Wood

Contact: Mark Wood

But a second record such as the following would be invalid: Contact Mark Wood.

Let’s demonstrate the Addlist Operation with a simple POC.

In the addlist-customer-flow as shown in the above screenshot, NetSuite Add list Connector inserts a list of customer records into the NetSuite system.

First, set up a HTTP Listener with a path and configure connection. and then add a NetSuite Add list connector into the flow. Sample input payload can be seen in the below screenshot where two different customer records are defined with the sample values.

Then add a NetSuite Add list connector, select Type of the record as Customer and provide payload in the Message.

Then add a Transform message before the Add operation and metadata will be generated automatically as shown in the below screenshot.

Select the required fields from the metadata and fill in the values that need to be added, now xsi schema needs to be defined in the code to make the operation work. Here is the example mapping with sample values for list of Customer records as shown in the below screenshot

And at the end of the flow add a Transform message and convert the output to JSON. Once the flow is triggered, NetSuite Add Connector will insert the Customer record and provide the NetSuite internal Id of the corresponding record in the response.

Sample Response:

Conclusion

In this blog, we have seen how to insert a list of records using the NetSuite Add list connector in MuleSoft.

--

--