Populate Sales Orders In NetSuite

Author: Anuj Prakash

Introduction

A Sales Order (SO) is a document that a business or sole trader sends to a customer to confirm the sale of products or services. It serves as a contract between the buyer and seller, outlining the details of the transaction, such as the products or services being sold, the quantity, price, and delivery or payment terms. The sales order is a crucial document in the sales process as it ensures that both parties are in agreement regarding the terms of the transaction. 

Purpose

A sales order record is an internal document that vendors create and keep on file. It enables businesses to track inventory and orders accurately, making it essential for ensuring order fulfillment and maintaining precise inventory records.

Now, there is a workaround to populate (i.e. create or update) SO records in NetSuite through MuleSoft. For that, we will use the Upsert connector provided by MuleSoft. The Upsert connector allows us to populate SO records. To prevent duplication of records, it is recommended to use an external Id.

Connector Setup
  • The connector setup is applicable for NetSuite version 11.x (i.e. v11 and above)
  • The first step is to create a connector configuration for the NetSuite connector in the Global Elements. To do that, Go to Global Elements -> Create -> Search NetSuite. Then select NetSuite Config.
  • Provide Signature algorithm, Wsdl version, SOAP port and set the Run server SuiteScript and trigger workflows to True.
  • Now, drag and drop the Upsert connector from the MuleSoft palette and select SalesOrder as the type.
Use Case

To populate SO, we will receive the required fields from the source system. To answer the question, how to know what all mandatory fields are required to create/update a SO record? 

There are few ways:

  1. Refer to https://www.netsuite.com/help/helpcenter/en_US/srbrowser/Browser2015_1/schema/other/salesorderitem.html?mode=package to get an overview of the field-level details.
  2. Create a SO record in NetSuite UI manually, while creating the record you will have to pass all the mandatory fields otherwise the record won’t be created.
Create a SO record in NetSuite UI
  • To create a SO record, search and select Page: Sales Orders. 
  • Fields containing an asterisk are mandatory fields.

Note: The UI of the Sales Order depends on the organization. So there is a high probability that the field names might look different for different organizations.

Preparing a Payload to create/update a SO record 
  • Drag and Drop a Transform Message component just before the Upsert connector.
  • Start creating the payload with the help of auto-populated Metadata. The Metadata contains Field Ids which we get from NetSuite. In our case, the Field Ids  are entity,tranDate,salesRep, etc.
  • To get the Field ID from NetSuite UI, click on the Field which we want to map according to our requirement. For example, after clicking on the “BILL TO CUSTOMER” field we can see “entity” as the ID.

Note: The Field Ids/Metadata will be different for different organizations.

  • We pass externalId, which works as an identifier that identifies whether the record should be created or updated. If the Id is not present in NetSuite, NetSuite will create a new SO record else it will update the existing record.
  • InternalId is a unique Id for every field or record. When we pass the internalId of the specific field then NetSuite updates that field. 
Steps to get the InternalId:
  • Home Screen -> Set Preferences (You will find this in the top left corner) -> General -> Show Internal IDs (mark it as checked, by default it is marked unchecked) -> Save.
  • To see an internalId, search for any record type (ex: customForm). An internal Id column will be searched and the IDs will be found.
  • Another method is to add a chrome extension NetSuite Field Explorer. Any field can be searched through this extension and we can get the corresponding internalId. You can find the Extension in the web browser’s top right corner.

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.