Mule Netsuite Connector V11 – Upsert List with Line Items

Author: Avatansh Sharma

Below article talks about Upsert List connector of Netsuite with an example of Invoice record type of Netsuite.

Before moving forward, it is advised that you refer below links to get an overview of Netsuite Connector V11 and to understand the basic configuration for setting up a Netsuite Connector V11 in Mule 4.

Please confirm below two points.

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

UPSERT LIST  –  This operation is used to add or update one or more instances of a record type in NetSuite without first determining whether the record exists in NetSuite.

External ID – Unique ID assigned to each record by the external system (like Salesforce, from incoming payload/request).

Mandatory fields on the particular record type you are working with, for insert as well as update scenarios: Typically for invoices, fields like customForm, customer, at least one line item, custom fields on invoice and accounts on invoice are some of the mandatory fields.

Use case 1: Upsert multiple invoices with Line Items into NetSuite
  1. A sub flow to Get an existing Invoice from Netsuite(optional).
  1. Drag an HTTP listener and set its port and path.
  1. A flow reference to subflow for getting an existing invoice (optional).
  1. A transform message to form the Upsert List XML request to be sent to Netsuite.
  1. Upsert List operation from NetSuite module/palette.
  1. Transform Message to convert XML response from Netsuite to JSON.

Flow to Upsert List of invoices into Netsuite.

The XML request to upsert invoices

  1. Both 2020_1 and 2020_2 in the namespace will work, make sure that the port passed in namespaces should be the same as the SOAP port in NetSuite Config.
  1. Namespaces are automatically generated using DataSense Explorer, but one might need to add some namespaces which are used in SOAP requests (Debug logs can be referred to get them).
  1. Please note that external ID is mandatory while using an UpsertList connector of Netsuite V11.

Select the connector configuration, type has to be set as “Invoice”.

One can test the flow by hitting the HTTP endpoint.

External links to get more information on:

Netsuite Record Types

Netsuite Error Codes

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.