Marty Zigman

Conversations with Marty Zigman

Certified Administrator • ERP • SuiteCloud

NetSuite SuiteScript 2.0 Lookup Hard-to-Search Values

NetSuite



This article is relevant if you are using NetSuite and you are having trouble getting to data that is not part of the standard record sets.

Background

Not all NetSuite records are exposed to the API in a standard fashion. A great example is the state and country list. See my article Download NetSuite JavaScript Country and State Lookups. You certainly can create a list of that data and maintain it in your code. But there may be a better way.

The Technique to get to NetSuite Hard to Find Information

The trick for getting to hard-to-search NetSuite data is to perform server-based memory-only record functions leveraging NetSuite’s rich model to hold metadata. The idea is to perform a record function that will not be committed but that will instead give you the data you need in your real work.

Example SuiteScript 2.0 for Looking Up Ship Status values

Below is a code snippet example that illustrates the technique.

//if the record supports create (record.create), use that approach; no record identifier required;
//but the following examples are more interesting.  Make sure that the record is in dynamic mode.

var rec = record.transform(
	{fromType: 'salesorder'
	,fromId: 489141
	,toType: 'itemfulfillment'
	,isDynamic: true}
);

//alternatively, load an existing itemfulfillment
var rec = record.load({type: 'itemfulfillment', id: 23911941, isDynamic: true});

//request data of the dropdown field that has the information you need
var opts = rec.getField({fieldId: 'shipstatus'}).getSelectOptions();

/*
JSON output of the opts object
[ 
	{
		"value": "A",
		"text": "Picked"
	},
	{
		"value": "B",
		"text": "Packed"
	},
	{
		"value": "C",
		"text": "Shipped"
	}
]

*/

Solve your NetSuite Enhancement Challenges

Don’t let built-in NetSuite features and documented APIs get in the way of your needed software solution. Contact us if you are ready to push NetSuite even farther to solve your real business requirements.

Marty Zigman LinkedIn

Marty Zigman

Holding three official certifications, Marty is widely recognized as a top NetSuite expert and leads a team of senior professionals at Prolecto Resources, Inc. A former Deloitte & Touche CPA and technology executive with CTO roles, he brings over 35 years of leadership in ERP, CRM, and eCommerce business systems. Contact Marty to engage directly.

BiographyYouTubeLinkedInX (Twitter)

Leave a Reply

Your email address will not be published. Required fields are marked *