📖 Appendix D: SuiteScript 2.x Glossary

Complete function reference • Searchable • With governance costs and examples

Showing all 50+ functions

N/record

📚 Module 3, 5, 6
record.create(options)
record.create({ type: record.Type.CUSTOMER, isDynamic: true })
Creates a new record in memory. Use isDynamic: true for sublist operations.
type, isDynamic, defaultValuesRecord0 units
record.load(options)
record.load({ type: record.Type.SALES_ORDER, id: 123, isDynamic: true })
Loads an existing record from the database.
type, id, isDynamicRecord5-10 units
record.save(options)
var id = myRecord.save({ enableSourcing: true })
Saves record to database. Returns internal ID.
enableSourcing, ignoreMandatoryFieldsNumber (ID)10-20 units
record.submitFields(options)
record.submitFields({ type: 'customer', id: 123, values: { comments: 'Updated' } })
Updates fields without loading record. Much more efficient!
type, id, values, optionsNumber (ID)2 units ⭐
▶ Show Example
// Much better than load() + setValue() + save()! record.submitFields({ type: record.Type.CUSTOMER, id: 12345, values: { 'comments': 'Updated via script' }, options: { ignoreMandatoryFields: true } });
record.delete(options)
record.delete({ type: record.Type.CUSTOMER, id: 123 })
Deletes a record. Cannot be undone!
type, idNumber (ID)20 units
record.copy(options)
record.copy({ type: record.Type.SALES_ORDER, id: 123 })
Creates a copy of an existing record (not saved).
type, id, isDynamicRecord10 units
record.getValue(options)
var value = myRecord.getValue({ fieldId: 'entity' })
Gets internal value of a field. For list fields, returns ID.
fieldIdString/Number/Date/Boolean0 units
record.getText(options)
var text = myRecord.getText({ fieldId: 'entity' })
Gets display text of a field. For list fields, returns name.
fieldIdString0 units
record.setValue(options)
myRecord.setValue({ fieldId: 'memo', value: 'Updated' })
Sets value of a body field.
fieldId, value, ignoreFieldChangeRecord0 units
record.getLineCount(options)
var count = myRecord.getLineCount({ sublistId: 'item' })
Returns number of lines in a sublist.
sublistIdNumber0 units
record.getSublistValue(options)
var qty = rec.getSublistValue({ sublistId: 'item', fieldId: 'quantity', line: 0 })
Gets value from a sublist line. Line is 0-based.
sublistId, fieldId, lineString/Number/Date0 units
record.setSublistValue(options)
rec.setSublistValue({ sublistId: 'item', fieldId: 'quantity', line: 0, value: 5 })
Sets value on a sublist line (standard mode).
sublistId, fieldId, line, valueRecord0 units
record.selectNewLine(options)
myRecord.selectNewLine({ sublistId: 'item' })
Selects new line for editing (dynamic mode).
sublistIdRecord0 units
record.setCurrentSublistValue(options)
rec.setCurrentSublistValue({ sublistId: 'item', fieldId: 'item', value: 123 })
Sets value on current line (dynamic mode).
sublistId, fieldId, valueRecord0 units
record.commitLine(options)
myRecord.commitLine({ sublistId: 'item' })
Commits current line to sublist (dynamic mode).
sublistIdRecord0 units
record.attach(options)
record.attach({ record: { type: 'file', id: 123 }, to: { type: 'customer', id: 456 } })
Attaches a record (like file) to another record.
record, tovoid10 units

N/runtime

📚 Module 10
runtime.getCurrentScript()
var script = runtime.getCurrentScript()
Returns current script object for parameters, governance.
Script0 units
runtime.getCurrentUser()
var user = runtime.getCurrentUser()
Returns current user with id, name, email, role.
User0 units
script.getRemainingUsage()
var remaining = runtime.getCurrentScript().getRemainingUsage()
Returns remaining governance units.
Number0 units
script.getParameter(options)
script.getParameter({ name: 'custscript_my_param' })
Gets script parameter value from deployment.
nameValue0 units

N/email

📚 Module 5
email.send(options)
email.send({ author: 123, recipients: 456, subject: 'Hi', body: '...' })
Sends email. Author must be employee ID.
author, recipients, cc, bcc, subject, body, attachments, relatedRecordsvoid20 units
▶ Show Example
email.send({ author: 123, recipients: ['customer@example.com', 456], cc: [789], subject: 'Your Order', body: '<html><body>Thank you!</body></html>', relatedRecords: { transactionId: orderId } });
email.sendBulk(options)
email.sendBulk({ author: 123, recipients: [...], subject: '...', body: '...' })
Sends bulk emails. Counts against daily limits.
author, recipients, subject, bodyvoid20 units

N/file

📚 Module 5
file.create(options)
file.create({ name: 'report.txt', fileType: file.Type.PLAINTEXT, contents: '...' })
Creates new file in memory. Call save() to store.
name, fileType, contents, folderFile0 (save: 10)
file.load(options)
file.load({ id: 123 })
Loads file from File Cabinet.
idFile10 units
file.getContents()
var contents = myFile.getContents()
Returns file contents as string.
String0 units

N/url

📚 Module 12
url.resolveScript(options)
url.resolveScript({ scriptId: '...', deploymentId: '...', params: {...} })
Generates URL to Suitelet/RESTlet. Use returnExternalUrl: true for external.
scriptId, deploymentId, params, returnExternalUrlString (URL)0 units
url.resolveRecord(options)
url.resolveRecord({ recordType: 'customer', recordId: 123 })
Generates URL to a NetSuite record.
recordType, recordId, isEditModeString (URL)0 units

N/redirect

📚 Module 12
redirect.toRecord(options)
redirect.toRecord({ type: 'salesorder', id: 123 })
Redirects user to a record.
type, id, isEditModevoid0 units
redirect.toSuitelet(options)
redirect.toSuitelet({ scriptId: '...', deploymentId: '...', parameters: {...} })
Redirects user to a Suitelet.
scriptId, deploymentId, parametersvoid0 units

N/render

📚 Module 12
render.create()
var renderer = render.create()
Creates TemplateRenderer for PDF generation.
TemplateRenderer0 units
renderer.renderAsPdf()
var pdfFile = renderer.renderAsPdf()
Renders template as PDF file.
File10 units
renderer.addRecord(options)
renderer.addRecord({ templateName: 'record', record: myRecord })
Adds record to renderer for template variables.
templateName, recordvoid0 units

N/format

📚 Module 5
format.parse(options)
format.parse({ value: '12/31/2024', type: format.Type.DATE })
Parses string to native type (Date, Number).
value, typeDate/Number0 units
format.format(options)
format.format({ value: new Date(), type: format.Type.DATETIME })
Formats value to string for display.
value, typeString0 units

N/task

📚 Module 8
task.create(options)
task.create({ taskType: task.TaskType.SCHEDULED_SCRIPT, scriptId: '...' })
Creates task to schedule script execution.
taskType, scriptId, deploymentId, paramsTask0 units
▶ Show Example
var scriptTask = task.create({ taskType: task.TaskType.SCHEDULED_SCRIPT, scriptId: 'customscript_my_scheduled', deploymentId: 'customdeploy_my_scheduled', params: { 'custscript_last_id': lastProcessedId } }); var taskId = scriptTask.submit();
task.submit()
var taskId = myTask.submit()
Submits task for execution. Returns task ID.
String (Task ID)0 units

N/log

📚 Module 2
log.debug(title, details)
log.debug('My Title', JSON.stringify(obj))
Debug message. Only shows at Debug log level.
title, details0 units
log.audit(title, details)
log.audit('Record Saved', 'ID: ' + id)
Audit message. For significant production events.
title, details0 units
log.error(title, details)
log.error('Error', e.message + ' | ' + e.stack)
Error message. Shows in red. Use in catch blocks.
title, details0 units
log.emergency(title, details)
log.emergency('CRITICAL', 'System failure')
Emergency message. Highest priority level.
title, details0 units

N/ui/serverWidget

📚 Module 12
serverWidget.createForm(options)
serverWidget.createForm({ title: 'My Form' })
Creates form for Suitelets.
title, hideNavBarForm0 units
form.addField(options)
form.addField({ id: 'custpage_myfield', type: serverWidget.FieldType.TEXT, label: 'My Field' })
Adds field to form. ID must start with 'custpage_'.
id, type, label, sourceField0 units
form.addButton(options)
form.addButton({ id: 'custpage_btn', label: 'Click', functionName: 'myFunc()' })
Adds button to form. functionName is client JS.
id, label, functionNameButton0 units
form.addSubmitButton(options)
form.addSubmitButton({ label: 'Submit' })
Adds submit button that POSTs form.
labelButton0 units
form.addSublist(options)
form.addSublist({ id: 'custpage_items', type: serverWidget.SublistType.LIST, label: 'Items' })
Adds sublist/table to form.
id, type, labelSublist0 units
response.writePage(form)
context.response.writePage(form)
Writes form to response (displays page).
form/listvoid0 units

📚 Complete SuiteScript 2.x Module Reference

All available N/ modules with descriptions and documentation links.

N/action
Execute record actions that emulate UI buttons. Load to trigger workflow actions or custom actions on records.
Client & Server📖 Docs
N/auth
Change NetSuite login credentials programmatically.
Server Only📖 Docs
N/cache
Cache data to improve script performance. Store frequently accessed data to reduce API calls.
Server Only📖 Docs
N/certificateControl
Access digital certificates for signing documents and secure communications.
Server OnlyCertificate Management permission📖 Docs
N/commerce
Access web store assets like items, cart, and customer data in SuiteCommerce context.
Client & Server📖 Docs
N/compress
Compress, decompress, and archive files (ZIP, GZIP).
Server Only📖 Docs
N/config
Access NetSuite configuration settings and company preferences.
Server Only📖 Docs
N/crypto
Hashing, HMAC, and symmetrical encryption using OpenSSL wrappers.
Server Only📖 Docs
N/crypto/certificate
Sign XML documents with digital certificates using asymmetric cryptography.
Server OnlyCertificate Access permission📖 Docs
N/crypto/random
Cryptographically-secure pseudo-random number generation.
Client & Server (2.1 for server)📖 Docs
N/currency
Work with exchange rates between currencies based on specific dates.
Client & Server📖 Docs
N/currentRecord
Access the current record instance in client scripts. Auto-loaded in entry point scripts.
Client Only📖 Docs
N/dataset
Create and manage datasets in SuiteAnalytics Workbook.
Server OnlySuiteAnalytics Workbook permission📖 Docs
N/documentCapture
Extract text content from documents (invoices, receipts, contracts) using AI.
Server Only (2.1)📖 Docs
N/email
Send regular, bulk, and campaign emails from within NetSuite.
Client & Server📖 Docs
N/encode
Convert strings between different character encodings (Base64, UTF-8, etc.).
Server Only📖 Docs
N/error
Create custom SuiteScript errors for try-catch statements.
Server Only📖 Docs
N/file
Work with files in NetSuite File Cabinet - create, read, upload, download.
Server Only📖 Docs
N/format
Convert strings to/from formatted data (dates, numbers, currency, phone).
Client & Server📖 Docs
N/format/i18n
Format currency with international locale settings.
Client & Server📖 Docs
N/http
Make HTTP requests to external services.
Client & Server📖 Docs
N/https
Make HTTPS requests. Encode binary content and access credential fields securely.
Client & Server📖 Docs
N/https/clientCertificate
Send SSL requests with mutual TLS using digital certificates.
Server OnlyCertificate Access permission📖 Docs
N/keyControl
Access key storage for secrets and credentials.
Server OnlyKey Management permission📖 Docs
N/llm
Use generative AI / large language models (LLMs) in scripts.
Server Only (2.1)📖 Docs
N/log
Log script execution details for debugging and auditing.
Client & Server📖 Docs
N/machineTranslation
Translate text into supported languages using generative AI.
Server Only (2.1)📖 Docs
N/pgp
Send PGP-encrypted secure messages to recipients.
Server Only (2.1)📖 Docs
N/piremoval
Remove personal information from system notes, workflow history, and fields (GDPR).
Server OnlyRemove Personal Information permissions📖 Docs
N/plugin
Load custom plug-in implementations for extensibility.
Server Only📖 Docs
N/portlet
Resize or refresh form portlets on dashboards.
Client Only📖 Docs
N/query
Create and run searches using SuiteQL (SQL-like syntax) via SuiteAnalytics Workbook.
Client & ServerSuiteAnalytics Workbook permission📖 Docs
N/record
Work with NetSuite records - create, load, save, delete, copy, transform.
Client & Server📖 Docs
N/recordContext
Get the context type of a record (how it was accessed).
Client & Server📖 Docs
N/redirect
Redirect users to URLs, Suitelets, records, task links, or searches.
Server Only📖 Docs
N/render
Create PDFs, forms from templates, and emails from templates. Print functionality.
Server OnlyAdvanced PDF/HTML Templates permission📖 Docs
N/runtime
Access runtime settings for company, script, session, user, and version info.
Client & Server📖 Docs
N/scriptTypes/restlet
Create custom request/response handling for RESTlet scripts.
RESTlet Only📖 Docs
N/search
Create and run saved searches. lookupFields, create, load, run, iterate results.
Client & Server📖 Docs
N/sftp
Connect to remote FTP servers using SFTP and transfer files.
Server OnlyKey Access permission (for public key auth)📖 Docs
N/suiteAppInfo
Access information about installed SuiteApps and Bundles.
Client & Server📖 Docs
N/task
Create and queue tasks: scheduled scripts, Map/Reduce, CSV imports, workflow execution.
Server OnlyTasks permission📖 Docs
N/task/accounting/recognition
Merge revenue arrangements or revenue elements for revenue recognition.
Server Only📖 Docs
N/transaction
Void transactions programmatically.
Client & Server📖 Docs
N/translation
Load Translation Collections for multi-language support.
Client & Server📖 Docs
N/ui/dialog
Create modal dialogs with buttons (alert, confirm, create).
Client Only📖 Docs
N/ui/message
Display messages at the top of the screen under the menu bar.
Client Only📖 Docs
N/ui/serverWidget
Build custom UIs - forms, fields, buttons, sublists for Suitelets and User Events.
Server Only📖 Docs
N/url
Build URLs for records, Suitelets, task links. Resolve domain paths.
Client & Server📖 Docs
N/util
Utility methods: isArray, isObject, isFunction, each, extend.
Client & Server📖 Docs
N/workbook
Create and manage workbooks in SuiteAnalytics Workbook (charts, pivots, tables).
Server OnlySuiteAnalytics Workbook permission📖 Docs
N/workflow
Initiate new workflow instances or trigger existing ones programmatically.
Server OnlyWorkflow permission📖 Docs
N/xml
Validate, parse, read, and modify XML documents. XPath support.
Client & Server📖 Docs