Global

Methods

createSubrecord(fldnam)

create a subrecord on body field on the current record on a page.
Parameters:
Name Type Description
fldnam string body field name
Since:
  • 2011.2
Source:

editSubrecord(fldnam)

edit a subrecord on body field on the current record on a page.
Parameters:
Name Type Description
fldnam string body field name
Since:
  • 2011.2
Source:

nlapiAddDays(d, days) → {date}

Add days to a Date object and returns a new Date
Parameters:
Name Type Description
d date date object used to calculate the new date
days int the number of days to add to this date object.
Since:
  • 2008.1
Source:
Returns:
Type
date

nlapiAddMonths(d, months) → {date}

Add months to a Date object and returns a new Date.
Parameters:
Name Type Description
d date date object used to calculate the new date
months int the number of months to add to this date object.
Since:
  • 2008.1
Source:
Returns:
Type
date

nlapiAttachRecord(type1, id1, type2, id2, properties) → {void}

Attach a single record to another with optional properties.
Parameters:
Name Type Argument Description
type1 string The record type name being attached
id1 int The internal ID for the record being attached
type2 string The record type name being attached to
id2 int The internal ID for the record being attached to
properties Object <optional>
Object containing name/value pairs used to configure attach operation
Since:
  • 2008.2
Source:
Returns:
Type
void

nlapiCancelLineItem(type) → {void}

Cancel any changes made on the currently selected line.
Parameters:
Name Type Description
type string sublist name
Since:
  • 2005.0
Source:
Returns:
Type
void

nlapiCommitLineItem(type) → {void}

Save changes made on the currently selected line to the sublist.
Parameters:
Name Type Description
type string sublist name
Since:
  • 2005.0
Source:
Returns:
Type
void

nlapiCopyRecord(type, id, initializeValues) → {nlobjRecord}

Return a new record using values from an existing record.
Parameters:
Name Type Description
type string The record type name.
id int The internal ID for the record.
initializeValues Object Contains an array of name/value pairs of defaults to be used during record initialization.
Since:
  • 2007.0
Source:
Returns:
Returns an nlobjRecord object of a copied record.
Type
nlobjRecord

nlapiCreateAssistant(title, hideHeader) → {nlobjAssistant}

Return a new assistant page.
Parameters:
Name Type Argument Description
title string page title
hideHeader boolean <optional>
true to hide the page header (false by default)
Since:
  • 2009.2
Source:
Returns:
Type
nlobjAssistant

nlapiCreateCurrentLineSubrecord(type, fldnam)

Create a subrecord on a sublist field on the current record on a page.
Parameters:
Name Type Description
type string sublist name
fldnam string sublist field name
Since:
  • 2011.2
Source:

nlapiCreateError(code, details, suppressEmail) → {nlobjError}

Create an nlobjError object that can be used to abort script execution and configure error notification
Parameters:
Name Type Argument Description
code string error code
details string error description
suppressEmail boolean <optional>
if true then suppress the error notification emails from being sent out (false by default).
Since:
  • 2008.2
Source:
Returns:
Type
nlobjError

nlapiCreateFile(name, type, contents) → {nlobjFile}

Instantiate a file object (specifying the name, type, and contents which are base-64 encoded for binary types.)
Parameters:
Name Type Description
name string file name
type string file type i.e. plainText, htmlDoc, pdf, word (see documentation for the list of supported file types)
contents string string containing file contents (must be base-64 encoded for binary types)
Since:
  • 2009.1
Source:
Returns:
Type
nlobjFile

nlapiCreateForm(title, hideHeader) → {nlobjForm}

Return a new entry form page.
Parameters:
Name Type Argument Description
title string page title
hideHeader boolean <optional>
true to hide the page header (false by default)
Since:
  • 2008.2
Source:
Returns:
Type
nlobjForm

nlapiCreateList(title, hideHeader) → {nlobjList}

Return a new list page.
Parameters:
Name Type Argument Description
title string page title
hideHeader boolean <optional>
true to hide the page header (false by default)
Since:
  • 2008.2
Source:
Returns:
Type
nlobjList

nlapiCreateRecord(type, initializeValues) → {nlobjRecord}

Instantiate a new nlobjRecord object containing all the default field data for that record type.
Parameters:
Name Type Description
type string record type ID.
initializeValues Object Contains an array of name/value pairs of defaults to be used during record initialization.
Since:
  • 2007.0
Source:
Throws:
  • Type
    SSS_INVALID_RECORD_TYPE
  • Type
    SSS_TYPE_ARG_REQD
Returns:
Returns an nlobjRecord object of a new record from the system.
Type
nlobjRecord

nlapiDateToString(d, formattype) → {string}

Convert a Date object into a String
Parameters:
Name Type Argument Description
d date date object being converted to a string
formattype string <optional>
format type to use: date|datetime|timeofday with date being the default
Since:
  • 2005.0
Source:
Returns:
Type
string

nlapiDeleteFile(id) → {id}

Delete a file from the file cabinet.
Parameters:
Name Type Description
id int internal ID of file to be deleted
Since:
  • 2009.1
Source:
Returns:
Type
id

nlapiDeleteRecord(type, id) → {void}

Delete a record from the system.
Parameters:
Name Type Description
type string The record type name.
id int The internal ID for the record.
Since:
  • 2007.0
Source:
Throws:
  • Type
    SSS_INVALID_RECORD_TYPE
  • Type
    SSS_TYPE_ARG_REQD
  • Type
    SSS_INVALID_INTERNAL_ID
  • Type
    SSS_ID_ARG_REQD
Returns:
Type
void

nlapiDetachRecord(type1, id1, type2, id2, properties) → {void}

Detach a single record from another with optional properties.
Parameters:
Name Type Argument Description
type1 string The record type name being attached
id1 int The internal ID for the record being attached
type2 string The record type name being attached to
id2 int The internal ID for the record being attached to
properties Object <optional>
Object containing name/value pairs used to configure detach operation
Since:
  • 2008.2
Source:
Returns:
Type
void

nlapiEditCurrentLineItemSubrecord(type, fldnam)

edit a subrecord on a sublist field on the current record on a page.
Parameters:
Name Type Description
type string sublist name
fldnam string sublist field name
Since:
  • 2011.2
Source:

nlapiEncrypt(s) → {string}

Encrypt a String using a SHA-1 hash function
Parameters:
Name Type Description
s string string to encrypt
Since:
  • 2009.2
Source:
Returns:
Type
string

nlapiEscapeXML(text) → {string}

Escape a String for use in an XML document.
Parameters:
Name Type Description
text string string to escape
Since:
  • 2008.1
Source:
Returns:
Type
string

nlapiExchangeRate(fromCurrency, toCurrency, date) → {float}

Calculate exchange rate between two currencies as of today or an optional effective date.
Parameters:
Name Type Argument Description
fromCurrency string, int internal ID or currency code of currency we are converting from
toCurrency string, int internal ID or currency code of currency we are converting to
date string <optional>
string containing date of effective exchange rate. defaults to today
Since:
  • 2009.1
Source:
Returns:
Type
float

nlapiFindLineItemMatrixValue(type, fldnam, column, val) → {int}

Return the 1st line number that a matrix field value appears in
Parameters:
Name Type Description
type string sublist name
fldnam string matrix field name
column int matrix column index (1-based)
val string the value being queried for in a matrix field
Since:
  • 2009.2
Source:
Returns:
Type
int

nlapiFindLineItemValue(type, fldnam, val) → {int}

Return the 1st line number that a sublist field value appears in
Parameters:
Name Type Description
type string sublist name
fldnam string sublist field name
val string the value being queried for in a sublist field
Since:
  • 2009.2
Source:
Returns:
Type
int

nlapiFormatCurrency(str) → {string}

Format a number for data entry into a currency field.
Parameters:
Name Type Description
str string numeric string used to format for display as currency using user's locale
Since:
  • 2008.1
Source:
Returns:
Type
string

nlapiGetContext() → {nlobjContext}

Return context information about the current user/script.
Since:
  • 2007.0
Source:
Returns:
Type
nlobjContext

nlapiGetCurrentLineItemIndex(type) → {int}

Return the line number for the currently selected line.
Parameters:
Name Type Description
type string sublist name
Since:
  • 2005.0
Source:
Returns:
Type
int

nlapiGetCurrentLineItemMatrixValue(type, fldnam, column) → {string}

Get the current value of a sublist field on the current record on a page.
Parameters:
Name Type Description
type string sublist name
fldnam string sublist field name
column int matrix column index (1-based)
Since:
  • 2009.2
Source:
Returns:
value
Type
string

nlapiGetCurrentLineItemText(type, fldnam) → {string}

Return the label of a select field's current selection on the currently selected line.
Parameters:
Name Type Description
type string sublist name
fldnam string sublist field name
Since:
  • 2005.0
Source:
Returns:
Type
string

nlapiGetCurrentLineItemValue(type, fldnam) → {string}

Return the value of a field on the currently selected line.
Parameters:
Name Type Description
type string sublist name
fldnam string sublist field name
Since:
  • 2005.0
Source:
Returns:
Type
string

nlapiGetDepartment() → {int}

Return the internal ID for the current user's department.
Since:
  • 2005.0
Source:
Returns:
Type
int

nlapiGetField(fldnam) → {nlobjField}

Return field definition for a field.
Parameters:
Name Type Description
fldnam string the name of the field
Since:
  • 2009.1
Source:
Returns:
Type
nlobjField

nlapiGetFieldMandatory(fldnam) → {boolean}

Return field mandatoriness.
Parameters:
Name Type Description
fldnam string field name
Since:
  • 2009.1
Source:
Returns:
Type
boolean

nlapiGetFieldText(fldnam) → {string}

Return the display value of a select field's current selection on the current record on a page.
Parameters:
Name Type Description
fldnam string the field name
Since:
  • 2005.0
Source:
Returns:
Type
string

nlapiGetFieldTexts(fldnam) → {string[]}

Return the values (via display text) of a multiselect field on the current record.
Parameters:
Name Type Description
fldnam string field name
Since:
  • 2009.1
Source:
Returns:
Type
string[]

nlapiGetFieldValue(fldnam) → {string}

Return the value of a field on the current record on a page.
Parameters:
Name Type Description
fldnam string the field name
Since:
  • 2005.0
Source:
Returns:
Type
string

nlapiGetFieldValues(fldnam) → {string[]}

Return the values of a multiselect field on the current record on a page.
Parameters:
Name Type Description
fldnam string the field name
Since:
  • 2005.0
Source:
Returns:
Type
string[]

nlapiGetLineItemCount(type) → {int}

Return the number of sublists in a sublist on the current record on a page.
Parameters:
Name Type Description
type string sublist name
Since:
  • 2005.0
Source:
Returns:
Type
int

nlapiGetLineItemField(type, fldnam, linenum) → {nlobjField}

Return field definition for a sublist field.
Parameters:
Name Type Argument Description
type string sublist name
fldnam string sublist field name
linenum int <optional>
line number for sublist field (1-based) and only valid for sublists of type staticlist and list
Since:
  • 2009.1
Source:
Returns:
Type
nlobjField

nlapiGetLineItemMandatory(type, fldnam) → {boolean}

Return sublist field mandatoriness.
Parameters:
Name Type Description
type string sublist name
fldnam string sublist field name
Since:
  • 2009.1
Source:
Returns:
Type
boolean

nlapiGetLineItemMatrixField(type, fldnam, linenum, column) → {nlobjField}

Return an nlobjField containing sublist field metadata.
Parameters:
Name Type Description
type string matrix sublist name
fldnam string matrix field name
linenum int line number (1-based)
column int matrix column index (1-based)
Since:
  • 2009.2
Source:
Returns:
Type
nlobjField

nlapiGetLineItemMatrixValue(type, fldnam, linenum, column, value)

Return the value of a sublist matrix field on the current record on a page.
Parameters:
Name Type Description
type string sublist name
fldnam string sublist field name
linenum int line number (1-based)
column int column index (1-based)
value string
Since:
  • 2009.2
Source:

nlapiGetLineItemText(type, fldnam, linenum) → {string}

Return the label of a select field's current selection for a particular line.
Parameters:
Name Type Description
type string sublist name
fldnam string sublist field name
linenum int line number (1-based)
Since:
  • 2005.0
Source:
Returns:
Type
string

nlapiGetLineItemValue(type, fldnam, linenum) → {string}

Return the value of a sublist field on the current record on a page.
Parameters:
Name Type Description
type string sublist name
fldnam string sublist field name
linenum int line number (1-based)
Since:
  • 2005.0
Source:
Returns:
Type
string

nlapiGetLocation() → {int}

Return the internal ID for the current user's location.
Since:
  • 2005.0
Source:
Returns:
Type
int

nlapiGetMatrixCount(type, fldnam) → {int}

Return the number of columns for a matrix field
Parameters:
Name Type Description
type string sublist name
fldnam string matrix field name
Since:
  • 2009.2
Source:
Returns:
Type
int

nlapiGetMatrixField(type, fldnam, column) → {nlobjField}

Return field definition for a matrix field.
Parameters:
Name Type Description
type string matrix sublist name
fldnam string matrix field name
column int matrix field column index (1-based)
Since:
  • 2009.2
Source:
Returns:
Type
nlobjField

nlapiGetMatrixValue(type, fldnam, column) → {string}

Get the value of a matrix header field
Parameters:
Name Type Description
type string sublist name
fldnam string sublist field name
column int matrix column index (1-based)
Since:
  • 2009.2
Source:
Returns:
Type
string

nlapiGetNewRecord() → {nlobjRecord}

Return an record object containing the data being submitted to the system for the currenr record.
Since:
  • 2008.1
Source:
Returns:
Type
nlobjRecord

nlapiGetOldRecord() → {nlobjRecord}

Return an record object containing the current record's data prior to the write operation.
Since:
  • 2008.1
Source:
Returns:
Type
nlobjRecord

nlapiGetRecordId() → {int}

Return the internal ID corresponding to the current page or userevent script.
Since:
  • 2007.0
Source:
Returns:
Type
int

nlapiGetRecordType() → {string}

Return the recordtype corresponding to the current page or userevent script.
Since:
  • 2007.0
Source:
Returns:
Type
string

nlapiGetRole() → {int}

Return the internal ID for the current user's role. Returns 31 (Online Form User) when called from online forms or "Available without Login" Suitelets.
Since:
  • 2005.0
Source:
Returns:
Type
int

nlapiGetSubsidiary() → {int}

Return the internal ID for the current user's subsidiary.
Since:
  • 2008.1
Source:
Returns:
Type
int

nlapiGetUser() → {int}

Return the internal ID for the currently logged in user. Returns -4 when called from online forms or "Available without Login" Suitelets.
Since:
  • 2005.0
Source:
Returns:
Type
int

nlapiInitiateWorkflow(recordtype, id, workflowid) → {int}

Initiates a workflow on-demand and returns the workflow instance ID for the workflow-record combination.
Parameters:
Name Type Description
recordtype string record type ID of the workflow base record
id int internal ID of the base record
workflowid string, int internal ID or script ID for the workflow definition
Since:
  • 2010.1
Source:
Returns:
Type
int

nlapiInsertLineItem(type, line)

Insert and select a new line into the sublist on a page or userevent.
Parameters:
Name Type Argument Description
type string sublist name
line int <optional>
line number at which to insert a new line.
Since:
  • 2005.0
Source:

nlapiInsertLineItemOption(type, fldnam, value, text, selected) → {void}

Adds a select option to a scripted select or multiselect sublist field.
Parameters:
Name Type Argument Description
type string sublist name
fldnam string sublist field name
value string internal ID for select option
text string display text for select option
selected boolean <optional>
if true then option will be selected by default
Since:
  • 2008.2
Source:
Returns:
Type
void

nlapiInsertSelectOption(fldnam, value, text, selected) → {void}

Adds a select option to a scripted select or multiselect field.
Parameters:
Name Type Argument Description
fldnam string field name
value string internal ID for select option
text string display text for select option
selected boolean <optional>
if true then option will be selected by default
Since:
  • 2008.2
Source:
Returns:
Type
void

nlapiIsLineItemChanged(type) → {boolean}

Returns true if any changes have been made to a sublist.
Parameters:
Name Type Description
type string sublist name
Since:
  • 2005.0
Source:
Returns:
Type
boolean

nlapiLoadConfiguration(type) → {nlobjConfiguration}

Loads a configuration record
Parameters:
Name Type Description
type string
Since:
  • 2009.2
Source:
Returns:
Type
nlobjConfiguration

nlapiLoadFile(id) → {nlobjFile}

Load a file from the file cabinet (via its internal ID or path).
Parameters:
Name Type Description
id string, int internal ID or relative path to file in the file cabinet (i.e. /SuiteScript/foo.js)
Since:
  • 2008.2
Source:
Returns:
Type
nlobjFile

nlapiLoadRecord(type, id, initializeValues) → {nlobjRecord}

Load an existing record from the system.
Parameters:
Name Type Description
type string The record type name.
id int The internal ID for the record.
initializeValues Object Contains an array of name/value pairs of defaults to be used during record initialization.
Since:
  • 2007.0
Source:
Throws:
  • Type
    SSS_INVALID_RECORD_TYPE
  • Type
    SSS_TYPE_ARG_REQD
  • Type
    SSS_INVALID_INTERNAL_ID
  • Type
    SSS_ID_ARG_REQD
Returns:
Returns an nlobjRecord object of an existing NetSuite record.
Type
nlobjRecord

nlapiLogExecution(type, title, details) → {void}

Create an entry in the script execution log (note that execution log entries are automatically purged after 30 days).
Parameters:
Name Type Argument Description
type string log type: debug|audit|error|emergency
title string log title (up to 90 characters supported)
details string <optional>
log details (up to 3000 characters supported)
Since:
  • 2008.1
Source:
Returns:
Type
void

nlapiLookupField(type, id, fields, text) → {string, Object}

Fetch the value of one or more fields on a record. This API uses search to look up the fields and is much faster than loading the record in order to get the field.
Parameters:
Name Type Argument Description
type string The record type name.
id int The internal ID for the record.
fields string, string[] field or fields to look up.
text boolean <optional>
If set then the display value is returned instead for select fields.
Since:
  • 2008.1
Source:
Returns:
single value or an Object of field name/value pairs depending on the fields argument.
Type
string, Object

nlapiMergeRecord(id, baseType, baseId, altType, altId, fields) → {nlobjFile}

Perform a mail merge operation using any template and up to 2 records and returns an nlobjFile with the results.
Parameters:
Name Type Argument Description
id int internal ID of template
baseType string primary record type
baseId int internal ID of primary record
altType string <optional>
secondary record type
altId int <optional>
internal ID of secondary record
fields Object <optional>
Object of merge field values to use in the mail merge (by default all field values are obtained from records) which overrides those from the record.
Since:
  • 2008.2
Source:
Returns:
Type
nlobjFile

nlapiOutboundSSO(ssoAppKey) → {string}

Return a URL with a generated OAuth token.
Parameters:
Name Type Description
ssoAppKey string
Since:
  • 2009.2
Source:
Returns:
Type
string

nlapiPrintRecord(type, id, format, properties) → {nlobjFile}

Print a record (transaction) gievn its type, id, and output format.
Parameters:
Name Type Argument Description
type string print output type: transaction|statement|packingslip|pickingticket
id int internal ID of record to print
format string <optional>
output format: html|pdf|default
properties Object <optional>
Object of properties used to configure print
Since:
  • 2008.2
Source:
Returns:
Type
nlobjFile

nlapiRefreshLineItems(type)

Refresh the sublist table.
Parameters:
Name Type Description
type string sublist name
Since:
  • 2005.0
Source:

nlapiRemoveCurrentLineItemSubrecord(type, fldnam)

remove a subrecord on a sublist field on the current record on a page.
Parameters:
Name Type Description
type string sublist name
fldnam string sublist field name
Since:
  • 2011.2
Source:

nlapiRemoveLineItem(type, line) → {void}

Remove the currently selected line from the sublist on a page or userevent.
Parameters:
Name Type Argument Description
type string sublist name
line int <optional>
line number to remove.
Since:
  • 2005.0
Source:
Returns:
Type
void

nlapiRemoveLineItemOption(type, fldnam, value) → {void}

Removes a select option (or all if value is null) from a scripted select or multiselect sublist field.
Parameters:
Name Type Description
type string sublist name
fldnam string sublist field name
value string internal ID for select option to remove
Since:
  • 2008.2
Source:
Returns:
Type
void

nlapiRemoveSelectOption(fldnam, value) → {void}

Removes a select option (or all if value is null) from a scripted select or multiselect field.
Parameters:
Name Type Description
fldnam string field name
value string internal ID of select option to remove
Since:
  • 2008.2
Source:
Returns:
Type
void

nlapiRequestURL(url, postdata, headers, callback) → {nlobjServerResponse}

Request a URL to an external or internal resource.
Parameters:
Name Type Argument Description
url string A fully qualified URL to an HTTP(s) resource
postdata string, Object <optional>
string, document, or Object containing POST payload
headers Object <optional>
Object containing request headers.
callback function <optional>
available on the Client to support asynchronous requests. function is passed an nlobjServerResponse with the results.
Since:
  • 2007.0
Source:
Throws:
  • Type
    SSS_UNKNOWN_HOST
  • Type
    SSS_INVALID_HOST_CERT
  • Type
    SSS_REQUEST_TIME_EXCEEDED
Returns:
Type
nlobjServerResponse

nlapiResolveURL(type, subtype, id, pagemode) → {string}

Resolve a URL to a resource or object in the system.
Parameters:
Name Type Argument Description
type string type specifier for URL: suitelet|tasklink|record|mediaitem
subtype string subtype specifier for URL (corresponding to type): scriptid|taskid|recordtype|mediaid
id string <optional>
internal ID specifier (sub-subtype corresponding to type): deploymentid|n/a|recordid|n/a
pagemode string <optional>
string specifier used to configure page (suitelet: external|internal, tasklink|record: edit|view)
Since:
  • 2007.0
Source:
Returns:
Type
string

nlapiScheduleScript(script, deployment, parameters) → {string}

Queue a scheduled script for immediate execution and return the status QUEUED if successfull.
Parameters:
Name Type Argument Description
script string, int script ID or internal ID of scheduled script
deployment string, int <optional>
script ID or internal ID of scheduled script deployment. If empty, the first "free" deployment (i.e. status = Not Scheduled or Completed) will be used
parameters Object Object of parameter name->values used in this scheduled script instance
Since:
  • 2008.1
Source:
Returns:
QUEUED or null if no available deployments were found or the current status of the deployment specified if it was not available.
Type
string

nlapiSearchDuplicate(type, fields, id) → {nlobjSearchResult[]}

Perform a duplicate record search using Duplicate Detection criteria.
Parameters:
Name Type Argument Description
type string The recordType you are checking duplicates for (for example, customer|lead|prospect|partner|vendor|contact).
fields string[] <optional>
array of field names used to detect duplicate (for example, companyname|email|name|phone|address1|city|state|zipcode).
id int <optional>
internal ID of existing record. Depending on the use case, id may or may not be a required argument.
Since:
  • 2008.1
Source:
Returns:
Returns an Array of nlobjSearchResult objects corresponding to the duplicate records.
Type
nlobjSearchResult[]

nlapiSearchGlobal(keywords) → {nlobjSearchResult[]}

Perform a global record search across the system.
Parameters:
Name Type Description
keywords string Global search keywords string or expression.
Since:
  • 2008.1
Source:
Returns:
Returns an Array of nlobjSearchResult objects containing the following four columns: name, type (as shown in the UI), info1, and info2.
Type
nlobjSearchResult[]

nlapiSearchRecord(type, id, filters, columns) → {nlobjSearchResult[]}

Perform a record search using an existing search or filters and columns.
Parameters:
Name Type Argument Description
type string record type ID.
id int, string <optional>
The internal ID or script ID for the saved search to use for search.
filters nlobjSearchFilter, nlobjSearchFilter[] <optional>
[optional] A single nlobjSearchFilter object - or - an array of nlobjSearchFilter objects.
columns nlobjSearchColumn, nlobjSearchColumn[] <optional>
[optional] A single nlobjSearchColumn object - or - an array of nlobjSearchColumn objects.
Since:
  • 2007.0
Source:
Throws:
  • Type
    SSS_INVALID_RECORD_TYPE
  • Type
    SSS_TYPE_ARG_REQD
  • Type
    SSS_INVALID_SRCH_ID
  • Type
    SSS_INVALID_SRCH_FILTER
  • Type
    SSS_INVALID_SRCH_FILTER_JOIN
  • Type
    SSS_INVALID_SRCH_OPERATOR
  • Type
    SSS_INVALID_SRCH_COL_NAME
  • Type
    SSS_INVALID_SRCH_COL_JOIN
Returns:
Returns an array of nlobjSearchResult objects corresponding to the searched records.
Type
nlobjSearchResult[]

nlapiSelectLineItem(type, linenum) → {void}

Select an existing line in a sublist.
Parameters:
Name Type Description
type string sublist name
linenum int line number to select
Since:
  • 2005.0
Source:
Returns:
Type
void

nlapiSelectNewLineItem(type) → {void}

Select a new line in a sublist.
Parameters:
Name Type Description
type string sublist name
Since:
  • 2005.0
Source:
Returns:
Type
void

nlapiSelectNode(node, xpath) → {node}

Select a node from an XML node using XPath. Supports custom namespaces (nodes in default namespace can be referenced using "nlapi" as the prefix)
Parameters:
Name Type Description
node node node being queried
xpath string string containing XPath expression.
Since:
  • 2008.1
Source:
Returns:
Type
node

nlapiSelectNodes(node, xpath) → {node[]}

Select an array of nodes from an XML node using XPath. Supports custom namespaces (nodes in default namespace can be referenced using "nlapi" as the prefix)
Parameters:
Name Type Description
node node node being queried
xpath string string containing XPath expression.
Since:
  • 2008.1
Source:
Returns:
Type
node[]

nlapiSelectValue(node, xpath) → {string}

select a value from an XML node using XPath. Supports custom namespaces (nodes in default namespace can be referenced using "nlapi" as the prefix)
Parameters:
Name Type Description
node node node being queried
xpath string string containing XPath expression.
Since:
  • 2008.2
Source:
Returns:
Type
string

nlapiSelectValues(node, xpath) → {string[]}

Select an array of values from an XML node using XPath. Supports custom namespaces (nodes in default namespace can be referenced using "nlapi" as the prefix)
Parameters:
Name Type Description
node node node being queried
xpath string string containing XPath expression.
Since:
  • 2008.1
Source:
Returns:
Type
string[]

nlapiSendCampaignEmail(campaigneventid, recipientid) → {int}

Sends a single on-demand campaign email to a specified recipient and returns a campaign response ID to track the email.
Parameters:
Name Type Description
campaigneventid int internal ID of the campaign event
recipientid int internal ID of the recipient - the recipient must have an email
Since:
  • 2010.1
Source:
Returns:
Type
int

nlapiSendEmail(from, to, subject, body, cc, bcc, records, files) → {void}

Send out an email and associate it with records in the system. Supported base types are entity for entities, transaction for transactions, activity for activities and cases, record|recordtype for custom records
Parameters:
Name Type Description
from int internal ID for employee user on behalf of whom this email is sent
to string, int email address or internal ID of user that this email is being sent to
subject string email subject
body string email body
cc string, string[] copy email address(es)
bcc string, string[] blind copy email address(es)
records Object Object of base types -> internal IDs used to associate email to records. i.e. {entity: 100, record: 23, recordtype: customrecord_surveys}
files nlobjFile[] array of nlobjFile objects (files) to include as attachments
Since:
  • 2007.0
Source:
Returns:
Type
void

nlapiSendFax(from, to, subject, body, records, files) → {void}

Send out a fax and associate it with records in the system. This requires fax preferences to be configured. Supported base types are entity for entities, transaction for transactions, activity for activities and cases, record|recordtype for custom records
Parameters:
Name Type Description
from int internal ID for employee user on behalf of whom this fax is sent
to string, int fax address or internal ID of user that this fax is being sent to
subject string fax subject
body string fax body
records Object Object of base types -> internal IDs used to associate fax to records. i.e. {entity: 100, record: 23, recordtype: customrecord_surveys}
files nlobjFile[] array of nlobjFile objects (files) to include as attachments
Since:
  • 2008.2
Source:
Returns:
Type
void

nlapiSetCurrentLineItemMatrixValue(type, fldnam, column, value, firefieldchanged, synchronous) → {void}

Set the current value of a sublist field on the current record on a page.
Parameters:
Name Type Argument Description
type string sublist name
fldnam string sublist field name
column int matrix column index (1-based)
value string matrix field value
firefieldchanged boolean <optional>
if false then the field change event is suppressed (defaults to true)
synchronous boolean <optional>
if true then sourcing and field change execution happens synchronously (defaults to false).
Since:
  • 2009.2
Source:
Returns:
Type
void

nlapiSetCurrentLineItemText(type, fldnam, txt, firefieldchanged, synchronous) → {void}

Set the value of a field on the currently selected line using it's label.
Parameters:
Name Type Argument Description
type string sublist name
fldnam string sublist field name
txt string string containing display value or search text.
firefieldchanged boolean <optional>
if false then the field change event is suppressed (defaults to true)
synchronous boolean <optional>
if true then sourcing and field change execution happens synchronously (defaults to false).
Since:
  • 2005.0
Source:
Returns:
Type
void

nlapiSetCurrentLineItemValue(type, fldnam, value, firefieldchanged, synchronous) → {void}

Set the value of a field on the currently selected line.
Parameters:
Name Type Argument Description
type string sublist name
fldnam string sublist field name
value string field value
firefieldchanged boolean <optional>
if false then the field change event is suppressed (defaults to true)
synchronous boolean <optional>
if true then sourcing and field change execution happens synchronously (defaults to false).
Since:
  • 2005.0
Source:
Returns:
Type
void

nlapiSetFieldMandatory(fldnam, mandatory) → {void}

Make a field mandatory.
Parameters:
Name Type Description
fldnam string field name
mandatory boolean if true then field is made mandatory
Since:
  • 2009.1
Source:
Returns:
Type
void

nlapiSetFieldText(fldnam, txt, firefieldchanged, synchronous) → {void}

Set the value of a field on the current record on a page using it's label.
Parameters:
Name Type Argument Description
fldnam string the field name
txt string display name used to lookup field value
firefieldchanged boolean <optional>
if false then the field change event is suppressed (defaults to true)
synchronous boolean <optional>
if true then sourcing and field change execution happens synchronously (defaults to false).
Since:
  • 2005.0
Source:
Returns:
Type
void

nlapiSetFieldTexts(fldnam, texts, firefieldchanged, synchronous) → {void}

Set the values (via display text) of a multiselect field on the current record on a page.
Parameters:
Name Type Argument Description
fldnam string field name
texts string[] array of strings containing display values for field
firefieldchanged boolean <optional>
if false then the field change event is suppressed (defaults to true)
synchronous boolean <optional>
if true then sourcing and field change execution happens synchronously (defaults to false).
Since:
  • 2009.1
Source:
Returns:
Type
void

nlapiSetFieldValue(fldnam, value, firefieldchanged, synchronous) → {void}

Set the value of a field on the current record on a page.
Parameters:
Name Type Argument Description
fldnam string the field name
value string value used to set field
firefieldchanged boolean <optional>
if false then the field change event is suppressed (defaults to true)
synchronous boolean <optional>
if true then sourcing and field change execution happens synchronously (defaults to false).
Since:
  • 2005.0
Source:
Returns:
Type
void

nlapiSetFieldValues(fldnam, values, firefieldchanged, synchronous) → {void}

Set the values of a multiselect field on the current record on a page.
Parameters:
Name Type Argument Description
fldnam string field name
values string[] array of strings containing values for field
firefieldchanged boolean <optional>
if false then the field change event is suppressed (defaults to true)
synchronous boolean <optional>
if true then sourcing and field change execution happens synchronously (defaults to false).
Since:
  • 2005.0
Source:
Returns:
Type
void

nlapiSetLineItemDisabled(type, fldnam, disable, linenum) → {void}

Disable a sublist field.
Parameters:
Name Type Description
type string sublist name
fldnam string sublist field name
disable boolean if true then field is disabled
linenum int line number for sublist field (1-based) and only valid for sublists of type list
Since:
  • 2009.1
Source:
Returns:
Type
void

nlapiSetLineItemMandatory(type, fldnam, mandatory) → {void}

Make a sublist field mandatory.
Parameters:
Name Type Description
type string sublist name
fldnam string sublist field name
mandatory boolean if true then field is made mandatory
Since:
  • 2009.2
Source:
Returns:
Type
void

nlapiSetLineItemValue(type, fldnam, linenum, value)

Set the value of a sublist field on the current record on a page.
Parameters:
Name Type Description
type string sublist name
fldnam string sublist field name
linenum int line number (1-based)
value string
Since:
  • 2005.0
Source:

nlapiSetMatrixValue(type, fldnam, column, value, firefieldchanged, synchronous) → {void}

Set the value of a matrix header field
Parameters:
Name Type Argument Description
type string sublist name
fldnam string sublist field name
column int matrix column index (1-based)
value string field value for matrix field
firefieldchanged boolean <optional>
if false then the field change event is suppressed (defaults to true)
synchronous boolean <optional>
if true then sourcing and field change execution happens synchronously (defaults to false).
Since:
  • 2009.2
Source:
Returns:
Type
void

nlapiSetRedirectURL(type, subtype, id, pagemode, parameters) → {void}

Redirect the user to a page. Only valid in the UI on Suitelets and User Events. In Client scripts this will initialize the redirect URL used upon submit.
Parameters:
Name Type Argument Description
type string type specifier for URL: suitelet|tasklink|record|mediaitem
subtype string subtype specifier for URL (corresponding to type): scriptid|taskid|recordtype|mediaid
id string <optional>
internal ID specifier (sub-subtype corresponding to type): deploymentid|n/a|recordid|n/a
pagemode string <optional>
string specifier used to configure page (suitelet: external|internal, tasklink|record: edit|view)
parameters Object <optional>
Object used to specify additional URL parameters as name/value pairs
Since:
  • 2007.0
Source:
Returns:
Type
void

nlapiStringToDate(str, format) → {date}

Convert a String into a Date object.
Parameters:
Name Type Description
str string date string in the user's date format, timeofday format, or datetime format
format string format type to use: date|datetime|timeofday with date being the default
Since:
  • 2005.0
Source:
Returns:
Type
date

nlapiStringToXML(str) → {document}

Convert a String into an XML document. Note that in Server SuiteScript XML is supported natively by the JS runtime using the e4x standard (http://en.wikipedia.org/wiki/E4X) This makes scripting XML simpler and more efficient
Parameters:
Name Type Description
str string string being parsed into an XML document
Since:
  • 2008.1
Source:
Returns:
Type
document

nlapiSubmitConfiguration(setup)

Commits all changes to a configuration record.
Parameters:
Name Type Description
setup nlobjConfiguration record
Since:
  • 2009.2
Source:
Returns:
(void)

nlapiSubmitField(type, id, fields, values, doSourcing) → {void}

Submit the values of a field or set of fields for an existing record.
Parameters:
Name Type Argument Description
type string The record type name.
id int The internal ID for the record.
fields string, string[] field or fields being updated.
values string, string[] field value or field values used for updating.
doSourcing boolean <optional>
If not set, this argument defaults to false and field sourcing does not occur.
Since:
  • 2008.1
Source:
Returns:
Type
void

nlapiSubmitFile(file) → {int}

Add/update a file in the file cabinet.
Parameters:
Name Type Description
file nlobjFile a file object to submit
Since:
  • 2009.1
Source:
Returns:
return internal ID of file
Type
int

nlapiSubmitRecord(record, doSourcing, ignoreMandatoryFields) → {string}

Submit a record to the system for creation or update.
Parameters:
Name Type Argument Description
record nlobjRecord nlobjRecord object containing the data record.
doSourcing boolean <optional>
If not set, this argument defaults to false.
ignoreMandatoryFields boolean <optional>
Disables mandatory field validation for this submit operation.
Since:
  • 2007.0
Source:
Throws:
  • Type
    SSS_INVALID_RECORD_OBJ
  • Type
    SSS_RECORD_OBJ_REQD
  • Type
    SSS_INVALID_SOURCE_ARG
Returns:
internal ID for committed record.
Type
string

nlapiTransformRecord(type, id, transformType, transformValues) → {nlobjRecord}

Create a new record using values from an existing record of a different type.
Parameters:
Name Type Argument Description
type string The record type name.
id int The internal ID for the record.
transformType string The recordType you are transforming the existing record into.
transformValues Object <optional>
An object containing transform default option/value pairs used to pre-configure transformed record
Since:
  • 2007.0
Source:
Throws:
  • Type
    SSS_INVALID_URL_CATEGORY
  • Type
    SSS_CATEGORY_ARG_REQD
  • Type
    SSS_INVALID_TASK_ID
  • Type
    SSS_TASK_ID_REQD
  • Type
    SSS_INVALID_INTERNAL_ID
  • Type
    SSS_INVALID_EDITMODE_ARG
Returns:
Type
nlobjRecord

nlapiTriggerWorkflow(recordtype, id, workflowid, actionid) → {int}

Triggers a workflow on a record.
Parameters:
Name Type Description
recordtype string record type ID of the workflow base record
id int internal ID of the base record
workflowid string, int internal ID or script ID for the workflow definition
actionid string, int internal ID or script ID of the action script
Since:
  • 2010.1
Source:
Returns:
Type
int

nlapiViewCurrentLineItemSubrecord(type, fldnam)

view a subrecord on a sublist field on the current record on a page.
Parameters:
Name Type Description
type string sublist name
fldnam string sublist field name
Since:
  • 2011.2
Source:

nlapiViewLineItemSubrecord(type, fldnam)

view a subrecord on a sublist field on the current record on a page.
Parameters:
Name Type Description
type string sublist name
fldnam string sublist field name
Since:
  • 2011.2
Source:

nlapiXMLToPDF(input) → {nlobjFile}

Generate a PDF from XML using the BFO report writer (see http://big.faceless.org/products/report/).
Parameters:
Name Type Description
input string string containing BFO compliant XHTML
Since:
  • 2009.1
Source:
Returns:
Type
nlobjFile

nlapiXMLToString(xml) → {string}

Convert an XML document into a String. Note that in Server SuiteScript XML is supported natively by the JS runtime using the e4x standard (http://en.wikipedia.org/wiki/E4X) This makes scripting XML data simpler and more efficient
Parameters:
Name Type Description
xml document document being serialized into a string
Since:
  • 2008.1
Source:
Returns:
Type
string

removeSubrecord(fldnam)

remove a subrecord on body field on the current record on a page.
Parameters:
Name Type Description
fldnam string body field name
Since:
  • 2011.2
Source:

viewSubrecord(fldnam)

view a subrecord on body field on the current record on a page.
Parameters:
Name Type Description
fldnam string body field name
Since:
  • 2011.2
Source: