NetSuite + Oracle Tips

NetSuite: Using SuiteScript 1.0 Code in Console Browser

Subscribe Here!

Back to main Blog
Bill Conway, NetSuite Practice Lead

Streamlining business processes and paving the way for future growth

Do you create a search every time to view field values hidden in the UI? Do you have to dig up the Schema browser to review the data structure when looking at NetSuite records? Changing field values in NetSuite or viewing the underlying data structure by creating and deploying full scripts is tedious.

Using basic SuiteScript 1.0 code can help streamline the process. Injecting code directly in the browser console can be useful for looking at:

  • records/sub-record field values
  • setting field values via code
  • emailing record values
  • and more

Here’s an example of loading a record to see the underlying data structure and values. This example features a customer record, but you can follow this process for any record type.

For other SuiteScript 1.0 functions, please reference the help guide inside of your NetSuite instance.

Load a Customer Record

  1. Open a customer record in NetSuite
  2. Open browser console. Select F12 or Right Click + Inspect

3. Write SuiteScript 1.0 directly into the browser

To load a customer record, use the nlapiLoadRecord(recordtype,internalid) function

  • In this example, the record type is customer
  • The internalid is part of the URL. In this case, it's 1825

Select Enter

4. Review the record data in the console browser.

Building Out SuiteScript 1.0

You can begin to build out SuiteScript 1.0 to create functions for commonly executed or more complex tasks. In this example automatically loads the current record you are browsing.

  1. Open your browser console, go to the source page and create a New Snippet

2. Create your function in SuiteScript1.0 code

This is the same functionality outlined in the beginning of the article. By using this function to pull all fields in a record, you do not have to perform the step of getting the record type and finding the internal ID.

Example code:

function loadCurrent() {

            recordId = nlapiGetRecordId();

            recordType = nlapiGetRecordType();

            return nlapiLoadRecord(recordType,


3. Select Ctr+Enter(or Click Play)

4. Call your function name in the Console

For this example, type: LoadCurrent() and select enter

5. Add additional functions to the snippet and save the snippet library to reuse a later date

More Sample Functions

Go to another page based on the record

goTo(type, id) {

              url = window.location.href;

              baseUrl =

              baseUrl +=
nlapiResolveURL('RECORD', type, id);

    , '_blank');


Compare the differences of two records

compare(type, id1, id2) {

              rec1 = nlapiLoadRecord(type, id1);

              rec2 = nlapiLoadRecord(type, id2);

              fldnames = rec1.fieldnames;

              diffs = {};

              for (var f = 0; f <
fldnames.length; f++) {

                             fldval1 =

                             fldval2 =

                             if (fldval1 !=
fldval2) {

= {'rec1' : fldval1, 'rec2' : fldval2}





Email the record information to

emailRecord() {

              user = nlapiGetUser();

              recordId = nlapiGetRecordId();

              recordType = nlapiGetRecordType();

              record =
nlapiLoadRecord(recordType, recordId);

              fieldInfo = '';

              fields = record.fields;

              for (key in fields) {

                             val = fields[key];

                             fieldInfo += key +
' : ' + val + '<br>';


              sublistInfo = '';

              sublists = record.lineitems;

              lineitems = Object.keys(sublists);

              for (sublist in lineitems){

                             subname =

                             sublistInfo +=
'<b>' + subname.toUpperCase() + ' ' + 'Sublist</b>' + '<br>';

                             for (element in
sublists[subname]) {

= sublists[subname][element];

(subelement != undefined) {

+= '<u>' + subname + ' ' + element + '</u> : <br>'

(key in subelement) {

= subelement[key];

+= key + ' : ' + innerval + '<br>';


+= '<br>';



                             sublistInfo +=


              text =
'<b>Fields:</b><br>' + fieldInfo +
'<b><br>Sublists:</b><br>' + sublistInfo;

              nlapiSendEmail(user, user,
recordType + ': ' + recordId, text);


These code snippets can help add additional value to NetSuite UI and resolve problems
without creating/deploying Suitelets.  

Have questions? Reach out to us. 


Have Questions? We are here to help.

Stay up to date