ANS-1924 · SUITESCRIPT DEVELOPMENT

How to Determine a NetSuite Record’s Specific Type from its Internal ID

Learn how to identify the precise record type, such as Customer or Sales Order, when only the general record category and internal ID are available.

Short answer

To determine a record's specific type from its general category and internal ID, perform a saved search on the general record type. Then, access the "recordType" property on the N/search.Result object for each search result. This method is effective for classifying records within broad categories like Entity, Transaction, and Activity.

Scenario

NetSuite users often encounter situations where they possess a record's internal ID and its general classification (e.g., Entity, Transaction, Activity) but need to identify its precise type, such as whether an Entity is a Lead, Prospect, or Customer, or if a Transaction is a Sales Order or Purchase Order. This ambiguity can arise when working with search results or integrating data, requiring a programmatic method to resolve the specific record type.

Solution

To determine the specific type of a record when only its general category and internal ID are known, perform a saved search on the general record type. For each result obtained from the search, access the recordType property on the N/search.Result object. This property will provide the precise record type.This approach is applicable for various general record types, including:

  • Entity (e.g., Lead, Prospect, Customer, Employee)
  • Transaction (e.g., Sales Order (SO), Purchase Order (PO), Invoice)
  • Activity (e.g., Event, Phone Call, Task)

Expert NetSuite Support

Need help with this NetSuite issue?

SuiteScript Development consulting and configuration support

Talk to a consultant