Record.setText(options)

Note:

The content in this help topic pertains to SuiteScript 2.0.

Method Description

Sets the value of the field by a text representation.

(dynamic and standard mode — see SuiteScript 2.x Standard and Dynamic Modes)

Sets a string value with a "%" for rate and ratehighprecision fields.

Returns

record.Record

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

Record Object Members

Since

2015.2

Parameters
Note:

The options parameter is a JavaScript object.

Parameter

Type

Required / Optional

Description

Since

options.fieldId

string

required

The internal ID of a standard or custom body field.

See, How to Find a Field's Internal ID.

2015.2

options.text

string | array

required

The text or texts to change the field value to.

  • If the field type is multiselect:

    • This parameter accepts an array of string values.

    • This parameter accepts a null value. Passing in null deselects all currently selected values.

  • If the field type is not multiselect, this parameter accepts only a single string value.

  • Inline HTML fields accept strings. Strings containing HTML tags are represented as strings in UI, this is demonstrated in Syntax section below.

2015.2

options.ignoreFieldChange

boolean

optional

If set to true, the field change and the secondary event is ignored.

By default, this value is false.

2015.2

Errors

Error Code

Thrown If

SSS_MISSING_REQD_ARGUMENT

A required argument is missing or undefined.

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
...
objRecord.setText({
    fieldId: 'item',
    text: 'value',
    ignoreFieldChange: true
});
...
// Add additional code 

        
Note:

The following code sample shows the syntax for INLINEHTML fields and what is returned.

          ...
objRecord.setText(inlineHtmlFieldId, '<i>foo</i>'); // Returns nonformatted text with the exact
                                                    // form given, i.e. '<i>foo</i>'
objRecord.getValue(inlineHtmlFieldId); // Returns '&lt;i&gt;foo&lt;/i&gt;'
objRecord.getText(inlineHtmlFieldId); // Returns '<i>foo</i>'
... 

        

Related Topics

record.Record
N/record Module
SuiteScript 2.x Modules
SuiteScript 2.x

General Notices