Field.getSelectOptions(options)

Method Description

Obtains an array of available options on a dropdown select, multi-select, or radio field.

The internal ID and label of the field options are returned as name/value pairs.

Important:

You can only use this method on a record in dynamic mode. For additional information about dynamic mode, see record.Record and SuiteScript 2.x Standard and Dynamic Modes.

Returns

Object[]

This function returns an array in the following format:

                    [{value: 5, text: 'abc'},{value: 6, text: '123'}] 

                  

This function returns Type Error if the field is not a supported field for this method.

If you attempt to get select options on a field that is not a dropdown select field, such as a popup select field or a field that does not exist on the form, null is returned. For example, if the number of options available for the field is greater than your setting for Maximum Entries in Dropdowns at Home > Set Preferences, the field becomes a popup field, and this method returns null.

Because the maximum value for the Maximum Entries in Dropdowns settings is 500, the maximum number of options that can be returned by this method is 500.

Note:

A call to this method may return different results for the same field for different roles.

Supported Script Types

Client and server scripts

For more information, see SuiteScript 2.x Script Types.

Governance

None

Module

N/record Module

Sibling Object Members

Field Object Members

Since

2015.2

Parameters
Note:

The options parameter is a JavaScript object.

Parameter

Type

Required / Optional

Description

Since

options.filter

string

required

The search string to filter the select options that are returned.

Note:

Filter values are case insensitive.

2015.2

options.operator

string

required

The following operators are supported:

  • contains (default)

  • is

  • startswith

2015.2

Syntax
Important:

The following code sample shows the syntax for this member. It is not a functional example. For a complete script example, see N/record Module Script Samples.

          // Add additional code 
...
var objRecord = record.load({
    type: record.Type.SALES_ORDER,
    id: 275 
});

var objField = objRecord.getField({
    fieldId: 'couponcode'
});

var options = objField.getSelectOptions({
    filter : 'C',
    operator : 'startswith'
});

//Perform an action with the options array
...  
// Add additional code 

        

Related Topics

General Notices