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.
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
- Drag an HTTP listener and set its port and path.
- A flow reference to subflow for getting an existing invoice (optional).
- A transform message to form the Upsert List XML request to be sent to Netsuite.
- Upsert List operation from NetSuite module/palette.
- Transform Message to convert XML response from Netsuite to JSON.
Flow to Upsert List of invoices into Netsuite.
The XML request to upsert invoices
- 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.
- 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).
- 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: