Search Custom Record in Netsuite Suite Script 2.0

NetSuite SuiteScript 2.0

Custom Record” is one of the powerful feature of Netsuite Suite Script 2.0. When custom record type is created, NetSuite provides two unique identifiers; ScriptID and InternalID.

When we are developing some script, scriptID is used as custom record identifier for search or record APIs. However, there are instances where InternalID of custom record is provided or used.

You can search Custom Record using filters/columns provided as:

function getCustomRecordType(internalId) {
	try {
		var filters = new Array();
		filters.push(new nlobjSearchFilter("internalid",null,"anyof",internalId));

		var columns = new Array();
		columns.push(new nlobjSearchColumn("scriptid"));

		var results = nlapiSearchRecord("customrecordtype", null, filters, columns);

		if (results && results.length > 0) {
			return results[0].getValue("scriptid").toLowerCase();
		} else {
			return null;

	} catch (e) {
		nlapiLogExecution("ERROR", "getCustomRecordType", e.message);

The above example is showing to not hard-code the script id instead use dynamic as required.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.