search.lookupFields(options)
Method Description |
Performs a search for one or more body fields on a record. You can use joined-field lookups with this method, with the following syntax:
The search.lookupFields(options) method also includes a promise version, search.lookupFields.promise(options). For more information about promises, see Promise Object. Note that the return contains either an object or a scalar value, depending on whether the looked-up field holds a single value, or a collection of values. Single select fields are returned as an object with value and text properties. Multi-select fields are returned as an object with value:text pairs. In the following example, a select field like For "
If you try to look up a field that does not exist on the specified record, an |
Returns |
Object | Object[]
|
Supported Script Types |
Client and server scripts For more information, see SuiteScript 2.x Script Types. |
Governance |
1 unit |
Module |
|
Since |
2015.2 |
In search/lookup operations, custom multiselect fields of type "long text" are truncated at 4,000 characters. In accounts with multiple languages enabled, the returned value is truncated at 1,300 characters. In accounts that don’t use multiple languages, the field return truncates at 3,900 characters. You can use the record.load(options) method as an alternative for retrieving desired results.
Parameters
The options parameter is a JavaScript object.
Parameter |
Type |
Required / Optional |
Description |
Since |
---|---|---|---|---|
|
enum |
required |
The search type for which you want to look up fields. Use the search.Type enum for this argument. |
2015.2 |
|
string |
required |
Internal ID for the record, for example 777 or 87. |
2015.2 |
|
string | string[] |
required |
Array of column/field names to look up, or a single column/field name. The |
2015.2 |
Errors
Error Code |
Message |
Thrown If |
---|---|---|
|
An nlobjSearchColumn contains an invalid column, or is not in proper syntax: {1}. |
The |
|
{1}: Missing a required argument: {2} |
Required parameter is missing. |
Syntax
The following code sample shows the syntax for this member. It is not a functional example. For a complete script example, see N/search Module Script Samples.
//Add additional code
...
var fieldLookUp = search.lookupFields({
type: search.Type.SALES_ORDER,
id: '87',
columns: ['entity', 'subsidiary', 'name', 'currency']
});
...
//Add additional code