crypto.checkPasswordField(options)

Note:

The content in this help topic pertains to SuiteScript 2.0.

Method Description

Checks whether a password in a record corresponds to the password entered by the user.

Use this method instead of Record.getValue(options) or CurrentRecord.getValue(options) on a custom password field. You should no longer use those methods for custom password fields. This method provides a more secure way to check custom password fields.

Returns

boolean

Supported Script Types

Server scripts

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

Governance

None

Module

N/crypto Module

Since

2021.1

Parameters

Note:

The options parameter is a JavaScript object.

Parameter

Type

Required / Optional

Description

Since

options.fieldId

string

required

ID of the password field.

2021.1

options.line

number

optional

Zero-based line index of the password field if the password is on a line.

2021.1

options.recordId

number

required

ID of the record that has the password field.

2021.1

options.recordType

string

required

Type of record that has the password field.

2021.1

options.sublistId

string

optional

ID of the sublist if the password field is on a sublist line.

2021.1

options.value

string

required

Input password value to be checked against the password stored in the record.

2021.1

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/crypto Module Script Samples.

            //Add additional code 
...
var options = {
    recordType: record.Type.SALES_ORDER,
    recordId: 6,
    fieldId: 'custitem1',
    sublistId: 'item',
    line: 0,
    value: 'theenteredpassword' 
}; 
if (crypto.checkPasswordField(options)) {
     log.debug('True'); 
} else {  
    log.debug('False'); 
}
...
//Add additional code 

          

Related Topics

N/crypto Module
SuiteScript 2.x Modules
SuiteScript 2.x

General Notices