Anypoint Connector for NetSuite synchronizes data and automates business processes between NetSuite and third party applications, either on-premise or in the cloud. This example shows you how to use the NetSuite connector in an Anypoint integration application.
This document assumes that you are familiar with Mule 101 and the Anypoint™ Studio interface. To increase your familiarity with Studio, consider completing one or more Anypoint Studio Tutorials. Further, this example assumes that you have a basic understanding of Mule flows and Mule Global Elements.
This application connects to NetSuite to retrieve a list of customers based on the predefined criteria (all customers that have a last name that starts with 'a'). The data is then parsed and formatted to improve readability and is displayed in the web browser for the end user.
Complete the following procedure to create, then run this example in your own instance of Anypoint Studio.
-
Open the Example project in Anypoint Studio from Anypoint Exchange. Do not run the application.
-
Replace http.port parameter in http:listener-config element with the valid value (for example: 8081).
-
Log in to your NetSuite account. You will need the login email (netsuite.email) and the password (netsuite.password) to connect to NetSuite using the connector later on.
-
Choose Setup > Integration > Web Services Preferences from the main menu. Store the value ACCOUNT ID that will be used as a netsuite.account parameter.
-
On the same page, if not present, insert a row into the table with your Name and a Web Services Default Role. Store the Role ID that will be used as a netsuite.roleId parameter.
-
In your application in Studio, click the Global Elements tab.
-
Double-click the NetSuite global element to open its Global Element Properties panel. Configure it as follows:
Email netsuite.email Password netsuite.password Account netsuite.account Role Id netsuite.roleId
You should verify the configuration by clicking Test Connection... button. Alternatively, you can also configure the global element in the XML Editor.
-
In the Package Explorer, right-click the get-customer-list-from-netsuite project name, then select Run As > Mule Application. Studio runs the application on the embedded server.
-
Hit your web browser with the following url: http://localhost:8081/customers?lastName=a to retrive a list of all customers having a last name starting with a. The data is stored in the HTML table.
-
Stop the Mule application by clicking the square, red terminate button in the Console.
Using a single flow, this application accepts incoming HTTP requests, performs a query in NetSuite and delivers results to the end user.
The HTTP connector listens at http://localhost:8081/customers to incoming HTTP Get requests. The dynamic part of the NetSuite customer query is extracted from the url under lastName parameter key using Mule Expression Language. Next, the MEL Expression block iterates over the returned collection and prepares an HTML table body that is sent to a Parse Template component that injects it into the HTML template.
Studio includes a feature that enables you to easily export all the documentation you have recorded for your project. Whenever you want to share your project with others outside the Studio environment, you can export the project's documentation to print, email or share online. Studio's auto-generated documentation includes:
- A visual diagram of the flows in your application
- The XML configuration which corresponds to each flow in your application
- The text you entered in the Notes tab of any building block in your flow
Follow the procedure to export auto-generated Studio documentation.
- Learn more about Connection Testing.
- Learn more about NetSuite Connector
- Learn more about Anypoint DataWeave.