Cloud Coders Warehouse Management System

Managing Script ID’s for select fields and User Event scripts

Managing Script ID’s for select fields and User Event scripts

OK, so this one is probably more technical than most people will ever need, but it is a really useful tool, that makes writing a lot of use cases quite straight forward.

This arose because we have been simplifying our applications a lot, and one of the hurdles that was causing us a lot of frustration, was how to link the record type internalid to the value used when a custom field is created in Netsuite.

To make it a bit clear, in NetSuite, the record Customer has two ID’s

InternalID ‘-203’
Script ID ‘customer’

The script ID is returned whenever you use nlapiGetRecordType() or equivalent method on the record you’re currently working on.

The Internal ID is returned when you use nlapiGetFieldValue(‘custrecord_record_type’), where the record type is of type List/Record of Scripted Record Type


Example Field
Custom Field for Script ID
Using nlapiGetFieldValue()
Exmaple yusing nlapiGetFieldValue()

So how can you EASILY get these values, and ensure that you can use them between accounts? The answer is surprisingly simple, but probably unintuitive.

Create a Custom Record in NetSuite with the following fields:

Example Custom Record

Example Custom Record

The tick with the second field (ID) is to source through the Script ID from the record field, and then you have a simple stable table (once you’ve loaded all the supported records into) to run appropriate operations off. Also note, the store value option is turned off:

ID Field Sourcing Value

Sourced ID Field

All the records with their script ID’s

Example record types