This article is relevant if you need to look up the custom records in your NetSuite account to learn the script identifiers.
Background
When creating SuiteScript, we often want to write our software in a manner that does not “hard code” references so that we have more freedom to distribute our work to new environments. Many of NetSuite’s SuiteScript functions require that you know the script ID of the target structure before you make the call.
But what if you don’t know the script ID of the custom record structure you are trying to target?
How To Lookup NetSuite Custom Record Script IDs
While not condoned as a regular practice, there are many undocumented features in the NetSuite development platform. It’s helpful to know some of these — yet we need to remember there is some risk that a discovered capacity can stop working at any moment.
Nonetheless, here is the SuiteScript pattern to search for the custom records defined in the NetSuite account and also learn each record’s script ID.
//SuiteScript 1.0 var columns = new Array(); columns[0] = new nlobjSearchColumn('name'); columns[1] = new nlobjSearchColumn('scriptid') var s = nlapiSearchRecord('customrecordtype', null, null, columns) //SuiteScript 2.0 var s = search.create({ type: "customrecordtype", columns: ["name","scriptid"] }).run().getRange(0,1000);
2023 Addendum
Chidi Okwudire wrote this article in 2023 that takes an approach with SQL now that the platform supports this at the API level. In 2015, I also wrote NetSuite Lookup: Get Custom Record Script ID from Internal ID Integer.
NetSuite Technical Leadership
If you found this article helpful, I am pleased. Our practice is to help our clients with all kinds of NetSuite innovations — thus we live in NetSuite SuiteScript every day and rely on our ability to deepen our knowledge and skills to be valued in the community. Perhaps you would like to be appreciated for your unique capacity to produce meaningful solutions in the NetSuite platform? If so, let’s have a conversation.