DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports
Events Video Library
Refcards
Trend Reports

Events

View Events Video Library

Related

  • SharePoint Integration With MuleSoft
  • MuleSoft Integration With RabbitMQ
  • Mastering Multi-Cloud Integration: SAFe 5.0, MuleSoft, and AWS - A Personal Journey
  • Integrated Gradients: AI Explainability for Regulated Industries

Trending

  • The Agentic Agile Office: Streamlining Enterprise Agile With Autonomous AI Agents
  • A Walk-Through of the DZone Article Editor
  • Using LLMs to Automate Data Cleaning and Transformation Pipelines
  • Run Gemma 4 on Your Laptop: A Hands-On Guide to Google's Latest Open Multimodal LLM
  1. DZone
  2. Software Design and Architecture
  3. Integration
  4. NetSuite Integration Using Mulesoft

NetSuite Integration Using Mulesoft

Learn how to implement NetSuite Integration using Mulesoft's NetSuite Connector v11.

By 
Harshad Bansode user avatar
Harshad Bansode
·
Oct. 25, 21 · Tutorial
Likes (3)
Comment
Save
Tweet
Share
16.6K Views

Join the DZone community and get the full member experience.

Join For Free

NetSuite software is an online service that enables companies to manage all key business processes in a single system. NetSuite provides cloud-based business management software that helps companies manage core business processes, ERP financials, CRM, e-commerce, inventory, and more.

Mulesoft provides NetSuite Connector, which synchronizes data and automates business processes between NetSuite and third-party applications, either on-premises or in the cloud.

NetSuite Connector provides the following features:

  • SOAP-based integration
  • Generation of NetSuite business objects
  • Different authentication levels
  • Error-handling support

Mulesoft released version 11 of NetSuite Connector in March 2021. This is a huge improvement over the previous version.

Major Changes to NetSuite Connector

NetSuite Connector v11 has significant performance improvements in terms of memory usage and has been able to address the issue with the old connector becoming unresponsive at times.

NetSuite Connector v11 exposes an XML-based interface, which is consistent with NetSuite’s SOAP web service. This means all requests/responses from the connector will be in XML and straightforward to map to the underlying NetSuite web service (WSDL).

NetSuite Connector v11 is not backward compatible. This means that if migrating to v11, DataWeave mapping must be changed. 

Looking at those benefits, it would be a good idea to start using NetSuite Connector v11.

GET Operation

Following is the simple application used to get the creditMemo from NetSuite based on internalId. 

Screenshot showing GetCreditMemo function of NetSuite.

XML
 
    <flow name="GetCreditMemo" doc:id="2f2ef1b2-39c7-4aad-8bd4-001fb5d5f44c" >
        <http:listener doc:name="Listener" doc:id="c0e4a905-ecbc-495a-83e3-4479437450d2" config-ref="HTTP_Listener_config" path="/creditMemo"/>
        <ee:transform doc:name="Transform Message" doc:id="d3981c8b-a95d-42c3-932d-09eb5aff2c90" >
            <ee:message >
                <ee:set-payload ><![CDATA[%dw 2.0
output application/xml
ns ns0 urn:messages_2020_2.platform.webservices.netsuite.com
ns ns1 urn:core_2020_2.platform.webservices.netsuite.com
ns xsi http://www.w3.org/2001/XMLSchema-instance
---
{
	ns0#get: {
		ns1#baseRef @("type": "creditMemo" , internalId: "2077523" , xsi#"type": "ns1:RecordRef"): {
		}
	}
}]]></ee:set-payload>
            </ee:message>
        </ee:transform>
        <netsuite:get doc:name="Get" doc:id="650f720d-a4ba-4c40-9c36-ce993d597f80" config-ref="NetSuite_Config" refType="RecordRef" type="creditMemo"/>
        <ee:transform doc:name="Transform Message" doc:id="b96003fd-7169-4365-bc73-1ef2f851ea0b" >
            <ee:message >
                <ee:set-payload ><![CDATA[%dw 2.0
output application/json
---
payload]]></ee:set-payload>
            </ee:message>
        </ee:transform>
        <logger level="INFO" doc:name="Logger" doc:id="3f038b27-393e-47c4-88de-8db9452341ad" message="#[payload]"/>
    </flow>


Have a look at the namespace and the attributes passed in the first "Transform Message." 

The attribute "type" defines the object to be worked on. In this case, it is creditMemo. Other valid examples are customer, salesOrder, and so on.

The next attribute, "internalId," is the internalId of the object in NetSuite.

Since it is the baseRef, we need to pass another attribute xsi#"type": "ns1:RecordRef"

Java
 
%dw 2.0
output application/xml
ns ns0 urn:messages_2020_2.platform.webservices.netsuite.com
ns ns1 urn:core_2020_2.platform.webservices.netsuite.com
ns xsi http://www.w3.org/2001/XMLSchema-instance
---
{
	ns0#get: {
		ns1#baseRef @("type": "creditMemo" , internalId: "2077523" , xsi#"type": "ns1:RecordRef"): {
		}
	}
}


UPDATE Operation

Following is the simple flow to update Customer in NetSuite.

Screenshot showing updateCustomerFlow function in NetSuite.

Java
 
<flow name="updateCustomerFlow" doc:id="4780c39f-d68f-43c0-93be-9e8492f99021" >
        <http:listener doc:name="Listener" doc:id="21df5619-4ad4-44f5-9bd1-38c6db2e63af" config-ref="HTTP_Listener_config" path="/updateCustomer"/>
        <ee:transform doc:name="Transform Message" doc:id="3dab5d5b-b3ee-4b05-b09d-e6656354d12b" >
            <ee:message >
                <ee:set-payload ><![CDATA[%dw 2.0
output application/xml
ns ns0 urn:messages_2020_2.platform.webservices.netsuite.com
ns ns01 urn:relationships_2020_2.lists.webservices.netsuite.com
ns ns02 urn:core_2020_2.platform.webservices.netsuite.com
ns xsi http://www.w3.org/2001/XMLSchema-instance
---
{
	ns0#update: {
		ns01#record @(internalId: "404220", xsi#"type": "ns01:Customer"): {
			ns01#isPerson: false,
			ns01#companyName: "ABC ORG",
			ns01#phone: "1234567890"
			
		}
	}
}]]></ee:set-payload>
            </ee:message>
        </ee:transform>
        <netsuite:update doc:name="Update" doc:id="ffa0beb0-e7d2-4c0f-9daf-ce235a44d54b" config-ref="NetSuite_Config" type="Customer"/>
        <ee:transform doc:name="Transform Message" doc:id="7b4dca9c-68c7-4bb5-bf6d-3a21a71e2318" >
            <ee:message >
                <ee:set-payload ><![CDATA[%dw 2.0
output application/json
---
payload]]></ee:set-payload>
            </ee:message>
        </ee:transform>
        <logger level="INFO" doc:name="Logger" doc:id="e3b845dd-2ae5-4969-83ae-286aecdc01f5" message="#[payload]"/>
    </flow>


Have a look at the namespace and the attributes passed in the first "Transform Message."

The attribute "internalId" is the internalId of the object in NetSuite. Please note that this needs to be added manually.

The attribute "type" defines the object to be worked on. In this case, it is customer. Other valid examples are creditMemo, salesOrder, and so on. 

Please note the namespace "ns01" for record. This is added manually after the drag and drop mapping.

Java
 
%dw 2.0
output application/xml
ns ns0 urn:messages_2020_2.platform.webservices.netsuite.com
ns ns01 urn:relationships_2020_2.lists.webservices.netsuite.com
ns ns02 urn:core_2020_2.platform.webservices.netsuite.com
ns xsi http://www.w3.org/2001/XMLSchema-instance
---
{
	ns0#update: {
		ns01#record @(internalId: "404220", xsi#"type": "ns01:Customer"): {
			ns01#isPerson: false,
			ns01#companyName: "ABC ORG",
			ns01#phone: "1234567890"
			
		}
	}
}


ADD Operation

Following is the example to add Contact in NetSuite.

Screenshot showing addContactFlow function in NetSuite.

Java
 
<flow name="addContactFlow" doc:id="db1ef95b-56b6-4089-97c0-5353d0407ccb" >
        <http:listener doc:name="Listener" doc:id="30359e75-0543-46de-a555-0715944e871f" config-ref="HTTP_Listener_config" path="/addContact"/>
        <ee:transform doc:name="Transform Message" doc:id="c7ad5432-e59d-42d4-b5ff-7998a7ab3980" >
            <ee:message >
                <ee:set-payload ><![CDATA[%dw 2.0
output application/xml
ns ns0 urn:messages_2020_2.platform.webservices.netsuite.com
ns ns01 urn:relationships_2020_2.lists.webservices.netsuite.com
ns ns02 urn:core_2020_2.platform.webservices.netsuite.com
ns xsi http://www.w3.org/2001/XMLSchema-instance
---
{
	ns0#add: {
		ns01#record @(xsi#"type": "ns01:Contact"): {
			ns01#salutation: "Dr",
			ns01#firstName: "FName",
			ns01#lastName: "LName",
			ns01#phone: "123456987",
			ns01#email: "[email protected]",
			ns01#subsidiary @(internalId: "1"): null
		}
	}
}]]></ee:set-payload>
            </ee:message>
        </ee:transform>
        <netsuite:add doc:name="Add" doc:id="9806ee25-1e35-470c-8f61-f830a8524a77" config-ref="NetSuite_Config" type="Contact"/>
        <ee:transform doc:name="Transform Message" doc:id="d89d8a23-7ab0-4778-b00b-8ce01a425043" >
            <ee:message >
                <ee:set-payload ><![CDATA[%dw 2.0
output application/java
---
{
}]]></ee:set-payload>
            </ee:message>
        </ee:transform>
        <logger level="INFO" doc:name="Logger" doc:id="b2c9ca28-438f-4243-878b-5a629162873c" message="#[payload]"/>
    </flow>


Have a look at the namespace and the attributes passed in the first "Transform Message."

The attribute "type" defines the object to be worked on. In this case, it is contact. Other valid examples are creditMemo, salesOrder, and so on.

Please note the namespace "ns01" for record. This is added manually after the drag and drop mapping.

Java
 
%dw 2.0
output application/xml
ns ns0 urn:messages_2020_2.platform.webservices.netsuite.com
ns ns01 urn:relationships_2020_2.lists.webservices.netsuite.com
ns ns02 urn:core_2020_2.platform.webservices.netsuite.com
ns xsi http://www.w3.org/2001/XMLSchema-instance
---
{
	ns0#add: {
		ns01#record @(xsi#"type": "ns01:Contact"): {
			ns01#salutation: "Dr",
			ns01#firstName: "FName",
			ns01#lastName: "LName",
			ns01#phone: "123456987",
			ns01#email: "[email protected]",
			ns01#subsidiary @(internalId: "1"): null
		}
	}
}


The above examples should act as a starting point for migrating to v11 on NetSuite Connector.

MuleSoft Connector (mathematics) Integration Attribute (computing)

Opinions expressed by DZone contributors are their own.

Related

  • SharePoint Integration With MuleSoft
  • MuleSoft Integration With RabbitMQ
  • Mastering Multi-Cloud Integration: SAFe 5.0, MuleSoft, and AWS - A Personal Journey
  • Integrated Gradients: AI Explainability for Regulated Industries

Partner Resources

×

Comments

The likes didn't load as expected. Please refresh the page and try again.

  • RSS
  • X
  • Facebook

ABOUT US

  • About DZone
  • Support and feedback
  • Community research

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Core Program
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 3343 Perimeter Hill Drive
  • Suite 215
  • Nashville, TN 37211
  • [email protected]

Let's be friends:

  • RSS
  • X
  • Facebook