ANS-1922 · SUITESCRIPT DEVELOPMENT

How to Inspect All Functions and Properties of a NetSuite Record Object?

Learn how to programmatically retrieve and log all available properties and methods of a NetSuite record using SuiteScript 2.x.

Short answer

To inspect all functions and properties of a NetSuite record object, load the record using `record.load()` and then iterate through its properties. Log the collected property names using `log.debug()` for review.

Scenario

A developer needs to understand the full structure and available methods of a specific NetSuite record type. They require a programmatic way to list all properties and functions associated with a loaded record object for debugging or development purposes.

Solution

To inspect all functions and properties of a NetSuite record object, load the desired record and then iterate through its keys. The following SuiteScript 2.x code snippet demonstrates how to achieve this, assuming the N/record and N/log modules are properly defined and available in your script's scope:

javascript
var loadedRecord record.load({
    type: 'invoice',
    id: 15187
});
var output = '';
for (var i in loadedRecord) {
    output + i + 'n';
}
log.debug({
    title: 'Object Functions',
    details: output
});

This script loads an Invoice record with internal ID 15187. It then iterates through all enumerable properties of the loadedRecord object, appending each property name followed by the character 'n' to the output string. Finally, it logs the complete list of property names to the script execution logs under the title 'Object Functions' for review.

Expert NetSuite Support

Need help with this NetSuite issue?

SuiteScript Development consulting and configuration support

Talk to a consultant