Record.setValue(options)
Method Description |
Sets the value of a field. (dynamic and standard mode — see SuiteScript 2.x Standard and Dynamic Modes)
Note:
For rate and ratehighprecisionfields, use the Record.setText(options) method to set a string value with a "%". |
Returns |
|
Supported Script Types |
Client and server scripts For more information, see SuiteScript 2.x Script Types. |
Governance |
None |
Module |
|
Sibling Object Members |
|
Since |
2015.2 |
Parameters
The options parameter is a JavaScript object.
Parameter |
Type |
Required / Optional |
Description |
Since |
---|---|---|---|---|
|
string |
required |
The internal ID of a standard or custom body field. |
2015.2 |
|
number | Date | string | array | boolean |
required |
The value to set the field to. The value type must correspond to the field type being set. For example:
For rate and ratehighprecisionfields, use the Record.setText(options) method to set a string value with a "%". |
2015.2 |
|
boolean |
optional |
If set to By default, this value is |
2015.2 |
Errors
Error Code |
Thrown If |
---|---|
|
The options.value type does not match the field type. |
|
A required argument is missing or undefined. |
Syntax
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.setValue({
fieldId: 'item',
value: true,
ignoreFieldChange: true
});
...
// Add additional code
The following code sample shows the syntax for INLINEHTML fields and what is returned.
...
objRececord.setValue(inlineHtmlFieldId, '<i>foo</i>'); // Returns text in cursive.
objRececord.getValue(inlineHtmlFieldId); // Returns '<i>foo</i>'
objRececord.getText(inlineHtmlFieldId); // Returns 'foo'
...