Basic Syntax
Documentation article about Basic Syntax
Basic Syntax
Basic Syntax
To understand the syntax of a simple search, we'll use the sample below:
{
"record": "supportcase",
"filters": ["internalid","anyof","${event.supportcase || 0}"],
"map": {
"id": "internalid",
"label": "casenumber"
} }
The record property sets the search type to run or the record type to search for. In the sample above, we're searching for Case records. You can find the ID of the record or search type using the NetSuite record browser. For more information see, Working with the SuiteScript Records Browser.
The filters property sets the search criteria.
The map property sets what results will be returned. In this example, you'll get back an object with two properties: id and label.
--- Context from https://docs.oracle.com/en/cloud/saas/netsuite/ns-online-help/chapter_N3169369.html --- To access the SuiteScript Records Browser, use the following link:
Go to the SuiteScript Records Browser
Important:
When writing SuiteScript, you must use the IDs listed in the NetSuite Help Center. You can access IDs by viewing a NetSuite record's page source, but not all IDs in the source code are supported in SuiteScript. If you create a script that references an unsupported or undocumented ID, and NetSuite later changes the ID, your script may break.
Not all fields in the SuiteScript Records Browser can be set using SuiteScript. Some fields are read only. Check the NetSuite UI to see if a field can be set. Generally, if you can set a field in the UI, you can set it using SuiteScript. If you cannot set a field in the UI, you cannot set it using SuiteScript. However, you can still get the field's value using SuiteScript.
The SuiteScript Records Browser provides a summary of all records, fields, sublists, search joins, search filters, search columns, and record transformations that are supported in SuiteScript. Information about elements is displayed as a series of tables.
To find SuiteScript-supported records and IDs:
Open the SuiteScript Records Browser.
Only records that officially support SuiteScript are listed in the SuiteScript Records Browser.
Click the record you want to reference in SuiteScript.
All IDs currently supported for the record are listed.
The following table provides examples of objects and methods that use each type of ID:
ID Type
Object Examples
Method Examples
Field IDs
serverWidget.Field
record.Field
record.Record
currentRecord.CurrentRecord
Record.getField(options)
CurrentRecord.getField(options)
Record.setValue(options)
CurrentRecord.setValue(options)
record.submitFields(options)
search.lookupFields(options)
Sublist and sublist field IDs
serverWidget.Sublist
Record.commitLine(options)
CurrentRecord.commitLine(options)
Record.getCurrentSublistValue(options)
CurrentRecord.getCurrentSublistValue(options)
Record
Frequently Asked Questions (4)
What are the prerequisites for using SuiteScript to perform searches on NetSuite records?
Can I modify all record fields via SuiteScript?
How does the 'map' property work in a SuiteScript search object?
What should I be cautious of when referencing record IDs in SuiteScript?
Weekly Update History (1)
Updated the Nested Searches topic to include an example.
View Oracle DocsWas this article helpful?