Follow Us On social
5717 Legacy Dr, Ste 250, Plano TX 75024 info@79consulting.com +1 (469) 606-9656
NetSuite Mulesoft connector

Performing a Search Using NetSuite Connector in MuleSoft

This blog will guide you through performing search operations using the NetSuite connector in MuleSoft.

NetSuite searches can be executed in two main ways:

  1. Using a Predefined Saved Search: Retrieve records from an existing saved search in NetSuite by referencing its savedSearchId.
  2. Creating Criteria in MuleSoft: Define search criteria directly within MuleSoft.

In this example, we will focus on executing a saved search by sending a SOAP request from MuleSoft to NetSuite. (SOAP, or Simple Object Access Protocol, is a protocol for exchanging structured information in web services using XML as the message format, enabling communication between applications over a network.)

Steps to Perform a NetSuite Search

Before diving in, it’s recommended to familiarize yourself with creating an XML file using DataWeave.


Step 1: Adding the NetSuite Connector in MuleSoft

Add the NetSuite connector to your project by dragging and dropping it from the Add Module section into your Mule palette.

NetSuite Mulesoft connector


Step 2: Configuring the NetSuite Connector

Drag the Search Operation from the Mule palette.

NetSuite Mulesoft connector
Click the plus icon to configure the NetSuite connector and fill in the required fields.

NetSuite Mulesoft connector


Step 3: Creating the NetSuite Search Request

NetSuite Mulesoft connector

Add a Transform Message shape before the NetSuite Search Operation. Expand it and write the DataWeave code for your request.

Use Case: Retrieve item saved search results from NetSuite with savedSearchId: '5927'.NetSuite Mulesoft connector

The resulting XML request will look like this:

NetSuite Mulesoft connector

Code Walkthrough:

  1. Include Namespaces:
    • To perform a search operation, include the “Message Namespace.”
    • NetSuite Mulesoft connector
    • Example: ns prefix <namespace URI>
      • ns ns0 urn:messages_2020_2.platform.webservices.netsuite.com
      • Note: _2020_2 indicates the NetSuite version, which must match the SOAP port configured in the NetSuite connector.
    • For an item search, include the Accounting Namespace.
    • NetSuite Mulesoft connector
  2. XML Structure:
    • Provide a searchRecord field.
    • For searchRecord, you can either:
      • Use savedSearchId with the ItemSearchAdvanced type.
      • Create custom criteria using the ItemSearch type.

Example 1: Using savedSearchId

  • Select ItemSearchAdvanced.
  • Include savedSearchId or savedSearchScriptId as attributes.

Example 2: Creating Criteria in the Request

  • Select ItemSearch as the type and define criteria within the request.

Use Case: Search for items with:

  • Type: Assembly
  • Location: Hyderabad (internalId: "1")

NetSuite Mulesoft connector

Code Walkthrough for Criteria-Based Search:

  1. Include the search field under the message namespace.
  2. For searchRecord, select the normal search type (ItemSearch).
  3. Under basic, which is of type ItemSearchBasic, define:
    • First Criterion:
      • Field: type
      • Attributes: operation and searchValue
      • Multiple searchValue pairs can be separated by commas.
    • Second Criterion:
      • Field: location
      • Type: recordRef
      • Use internalId as an attribute.

Step 4: Transforming the Final Message

Add a Transform Message shape to process and display the final search result.

 

NetSuite Mulesoft connector


By following these steps, you can effectively perform search operations using the NetSuite connector in MuleSoft, whether by utilizing predefined saved searches or creating custom criteria within MuleSoft. These methods enable seamless integration with NetSuite and streamline data retrieval processes, making it easier to manage and manipulate data for your business needs.

If you’re ready to optimize your NetSuite workflows with MuleSoft or need expert guidance, contact us today to get started.

 

 

Post a Comment

Top