pageInit(scriptContext)

Important:

Client scripts only execute in edit mode. If you have a deployed client script with a pageInit entry point, that script does not execute when you view the form. It executes when you click Edit.

Description

Defines the function that is executed after the page completes loading or when the form is reset.

The following sample tasks can be performed:

  • Populate field defaults.

  • Disable or enable fields.

  • Change field availability or values depending on the data available for the record.

  • Add flags to set initial values of fields.

  • Provide alerts where the data being loaded is inconsistent or corrupted.

  • Retrieve user login information and change field availability or values accordingly.

  • Validate that fields required for your custom code (but not necessarily required for the form) exist.

For an example, see SuiteScript Client Script Sample.

Returns

void

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.mode

string

The mode in which the record is being accessed. The mode can be set to one of the following values:

  • copy

  • create

  • edit

Version 2015 Release 2

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

Related Topics

SuiteScript 2.x Client Script Entry Points and API
fieldChanged(scriptContext)
lineInit(scriptContext)
postSourcing(scriptContext)
saveRecord(scriptContext)
sublistChanged(scriptContext)
validateDelete(scriptContext)
validateField(scriptContext)
validateInsert(scriptContext)
validateLine(scriptContext)
localizationContextEnter(scriptContext)
localizationContextExit(scriptContext)

General Notices