Apisero is now part of NTT DATA - Learn more.

Search
Close this search box.

Netsuite v11 connector – Part 2

Author: Ginni Madnani

In this article, we will see how to make XML SOAP requests for v11 connectors and various operations available NetSuite connector v11.

 Before going forward one has to confirm two things:

  1. In the pom.xml file of the Mule project,  check that the NetSuite Connector dependency version is 11. X.x.
  2. Test connection with NetSuite is successful.
NetSuite Operations discussed in depth:
  • ADD
  • ADD LIST 
  • UPSERT
  • UPSERT LIST 

ADD – This operation is used to add a particular record in NetSuite.

Use case: Adding  an invoice object  to NetSuite
  1. Drag an HTTP listener and set its port and path
  2. A transform message for the XML request
  3. Add operation from NetSuite palette
  4. Transform Message to convert XML response to JSON
  5. Loggers to capture logs

Select the connector configuration for NetSuite config which we have already setup.

Also select the general type where you want to add the NetSuite object.

So to get all the fields that will be needed while creating the netsuite invoice object.

https://www.netsuite.com/help/helpcenter/en_US/srbrowser/Browser2016_1/schema/record/invoice.html

Here you will get all the fields for any object on netsuite.

Now we need to create the mapping for the netsuite object so that we can add it to the netsuite.

For this one, we will be only adding the mandatory fields to create the invoice object in netsuite.

%dw 2.0

output application/xml

ns ns0 urn:messages_2020_2.platform.webservices.netsuite.com

ns ns02 urn:core_2020_2.platform.webservices.netsuite.com

ns ns01 urn:sales.transactions.webservices.netsuite.com

ns xsi http://www.w3.org/2001/XMLSchema-instance

{

ns0#add: {

ns01#record @(xsi#”type”: “ns01:Invoice”): {

ns01#entity @(internalId: “2319”): null,

ns01#department @(internalId: “101”): null,

ns01#itemList:{

ns01#item:{

ns01#item @(internalId: “208”): null,

ns01#amount: “25692555”

}

},

}

}

}

And on a successful upsert, we will get the below response.

ADD LIST– This operation is used to add a list of records in NetSuite.

Use case: Adding a list of account object to NetSuite
  1. Drag an HTTP listener and set its port and path
  2. A transform message for the XML request
  3. Add List operation from NetSuite palette
  4. Transform Message to convert XML response to JSON
  5. Loggers to capture logs

Select the connector configuration for NetSuite config which we have already setup.

Also select the general type where you want to add the NetSuite object.

So to get all the fields that will be needed while creating the NetSuite account object
https://www.netsuite.com/help/helpcenter/en_US/srbrowser/Browser2016_1/schema/record/account.html

Now we need to create the mapping for the netsuite object so that we can add it to the NetSuite.

For this one, we will be  only adding the mandatory fields to create the account object in Netsuite

%dw 2.0

output application/xml

ns ns0 urn:messages.platform.webservices.netsuite.com

ns ns01 urn:core.platform.webservices.netsuite.com

ns ns02 urn:accounting.lists.webservices.netsuite.com

ns xsi http://www.w3.org/2001/XMLSchema-instance

{

ns0#addList: {

ns0#record @(“xmlns:ns0″: ns0,”xmlns:ns02″: ns02,xsi#”type”: “ns02:Account”): {

ns02#acctName: “Mule test 1”,

ns02#description: “Testing add list test1”,

ns02#acctNumber: “9001”,

ns02#acctType: “_income”,

ns02#externalId: “mule1”,

},

ns0#record @(“xmlns:ns0″: ns0,”xmlns:ns02″: ns02,xsi#”type”: “ns02:Account”): {

ns02#acctName: “Mule test 2”,

ns02#description: “Testing add list test2”,

ns02#acctNumber: “9002”,

ns02#acctType: “_bank”,

ns02#externalId: “mule2”

Output for successful addition of two account records :

UPSERT – This operation is used to update a particular record if it exists or will create a new one in NetSuite.

Use case: Upserting a invoice object to NetSuite
  1. Drag an HTTP listener and set its port and path
  2. A transform message for the XML request
  3. Upsert operation from NetSuite palette
  4. Transform Message to convert XML response to JSON
  5. Logger to capture logs

Select the connector configuration for NetSuite config which we have already setup.

Also, select the general type where you want to add the NetSuite object.

So to get all the fields that will be needed while creating/update the NetSuite invoice object
https://www.netsuite.com/help/helpcenter/en_US/srbrowser/Browser2016_1/schema/record/invoice.html

Here you will get all the fields for any object on Netsuite.

Now we need to create the mapping for the NetSuite object to upsert it to the NetSuite.

For this one, we will be  updating/creating the mandatory fields to update/create the invoice object in Netsuite.

%dw 2.0

output application/xml

ns ns0 urn:messages_2020_2.platform.webservices.netsuite.com

ns ns02 urn:core_2020_2.platform.webservices.netsuite.com

ns ns01 urn:sales.transactions.webservices.netsuite.com

ns xsi http://www.w3.org/2001/XMLSchema-instance

{

ns0#upsert: {

ns0#record @(“xmlns:ns0″:ns0,”xmlns:ns01″:ns01,xsi#”type”:”ns01:Invoice”,externalId:”USA”):

{

ns01#entity @(internalId: “2319”): null,

ns01#department @(internalId: “101”): null,

ns01#itemList:{

ns01#item:{

ns01#item @(internalId: “208”): null,

ns01#amount: “565689”

}

},

}

}

}

And on a successful upsert, we will get the below response.

UPSERT LIST – This operation is used to update multiple records if it exists or will create a new one in NetSuite.

Use case: Upserting multiple invoice object to NetSuite
  1. Drag an HTTP listener and set its port and path
  2. A transform message for the XML request
  3. Upsert List  operation from NetSuite palette
  4. Transform Message to convert XML response to JSON
  5. Loggers to capture logs

Select the connector configuration for NetSuite config which we have already setup.

Also, select the general type where you want to add the NetSuite object

For this one, we will be only updating/creating the mandatory fields to update/create the invoice object in Netsuite.

%dw 2.0

output application/xml

ns ns0 urn:messages_2020_2.platform.webservices.netsuite.com

ns ns02 urn:core_2020_2.platform.webservices.netsuite.com

ns ns01 urn:sales.transactions.webservices.netsuite.com

ns xsi http://www.w3.org/2001/XMLSchema-instance

{

ns0#upsertList: {

ns0#record @(“xmlns:ns0″:ns0,”xmlns:ns01″:ns01,xsi#”type”:”ns01:Invoice”):

{

ns01#entity @(internalId: “2319”): null,

ns01#department @(internalId: “101”): null,

ns01#itemList:{

ns01#item:{

ns01#item @(internalId: “208”): null,

ns01#amount: “741852963”

}

},

ns01#externalId :”test1″

},

ns0#record @(“xmlns:ns0″:ns0,”xmlns:ns01″:ns01,xsi#”type”:”ns01:Invoice”):

{

ns01#entity @(internalId: “2319”): null,

ns01#department @(internalId: “101”): null,

ns01#itemList:{

ns01#item:{

ns01#item @(internalId: “208”): null,

ns01#amount: “741852963”

}

},

ns01#externalId :”test2″

}

}

}

And on a successful upsert list, we will get the below response.

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.