Netsuite Suitelet Overview

Suitelets are extensions of SuiteScript that allow developers to write custom NetSuite pages and backend logic. Suitelets are server side scripts that operate in a request-response model. They are invoked by HTTP GET or POST requests to system generated URLs, and by default they are invoked by making a GET request from a browser.

Before beginning with SuiteScript (suitelet) development, you must enable the Server SuiteScript feature to use it and also enable Netsuite to display "Internal ID" of entities in the preferences.

1. Enable SuiteScript feature: Go to Setup -> Company -> Enable Features, and check Server SuiteScript on the General Tab.

2. Display Internal ID: Go to Home -> Set Preferences, and check Show Internal IDs. When Show Internal IDs is checked, the IDs for records are displayed in the ID column of record lists, and this Internal ID should be used in your script when manipulating a record.

The entry point of the function within the Suitelet has two mandatory arguments: request and response. These arguments are instances of nlobjRequest and nlobjResponse, respectively.

Suitelets serve dual purpose: building custom Netsuite Pages and performing backend logic (an alternative to SuiteTalk web service). The custom Netsuite pages are generally built with UI objects such as nlobjForm, and construct HTML to be displayed to a user. On the other hand, the backend Suitelets provide "web" services to internal SuiteScripts, or external web pages.

Communication with the Suitelet is done strictly with the request and response objects. NetSuite generates a URL to invoke this Suitelet. Here is an example of Suitelet from Netsuite Documentation.

 * This function searches for customer records that match a supplied parameter
 * custparam_phone and return the results in a string separated by the |
 * character.
function lookupPhoneBackendSuitelet(request, response)
	if(request.getMethod() == 'GET') {
		// null check on the required parameter
		if(request.getParameter('custparam_phone') != null) {
			// Setting up the filters and columns
			var filters = new Array();
			var columns = new Array();
			// Use the supplied custparam_phone value as filter
			filters[0] = new nlobjSearchFilter(
				'phone', null, 'is', request.getParameter('custparam_phone'));
			columns[0] = new nlobjSearchColumn('entityid', null, null);
			// Search for customer records that match the filters
			var results = nlapiSearchRecord('customer', null, filters,
			if (results != null)
				var resultString = '';
				// Loop through the results
				for(var i = 0; i < results.length; i++) {
					// constructing the result string
					var result = results[i];
					resultString = resultString + result.getValue('entityid');
					// adding the | seperator
					if (i != parseInt(results.length - 1)) {
						resultString = resultString + '|';
					nlapiLogExecution('DEBUG', 'resultString', resultString);
			} else {
				response.write('none found');

Unlike SuiteTalk web service scripts, the backend Suitelets are designed to be made available to the public without consuming additional Netsuite License or running into concurrency issues. For those simple tasks such as creating a lead (or customer), or creating an opportunity is easily accomplished with Suitelets and preferred over SuiteTalk web service. The larger batch processing type of tasks should be delegated to SuiteTalk over backend Suitelets.


Add new comment

Filtered HTML

  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <blockquote> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.