validateField(scriptContext)

Description

Defines the validation function that is executed when a field is changed by a user or client call.

This event executes on fields added in beforeLoad user event scripts.

The following sample tasks can be performed:

  • Validate field lengths.

  • Restrict field entries to a predefined format.

  • Restrict submitted values to a specified range

  • Validate the submission against entries made in an associated field.

For an example, see SuiteScript Client Script Sample.

Note:

This event does not apply to list or box fields.

Returns

true if the field is valid and the change is successful.

false otherwise.

Since

Version 2015 Release 2

Parameters
Note:

The scriptContext parameter is a JavaScript object. It is automatically passed to the script entry point by NetSuite.

Parameter

Type

Description

Since

scriptContext.currentRecord

currentRecord.CurrentRecord

The current form record.

For more information about CurrentRecord object members, see CurrentRecord Object Members.

Version 2015 Release 2

scriptContext.sublistId

string

The sublist ID name.

Version 2015 Release 2

scriptContext.fieldId

string

The field ID name.

Version 2015 Release 2

scriptContext.line

string

The line number (zero-based index) if the field is in a sublist or a matrix.

If the field is not a sublist or matrix, the default value is undefined.

Version 2015 Release 2

scriptContext.column

string

The column number (zero-based index) if the field is in a matrix.

If the field is not in a matrix, the default value is undefined.

Version 2015 Release 2

For an example of the validateField entry point, see SuiteScript Client Script Sample.

Related Topics

General Notices