Form.addSecretKeyField(options)

Method Description

Adds a secret key field to the form.

This key can be used in crypto modules to perform encryption or hashing.

Important:

The default maximum length for a secret key field is 32 characters. If needed, use the Field.maxLength property to change this value.

Returns

serverWidget.Field object

Supported Script Types

SuiteScript 2.x Suitelet Script Type and SuiteScript 2.x User Event Script Type (beforeLoad(context))

Governance

None

Module

N/ui/serverWidget Module

Since

2016.1

Parameters
Note:

The options parameter is a JavaScript object.

Parameter

Type

Required / Optional

Description

Since

options.id

string

required

The internal ID of the secret key field.

The internal ID must be in lowercase, contain no spaces, and include the prefix custpage if you are adding the field to an existing page.

2016.1

options.restrictToScriptIds

string | string[]

required

The ID or list of IDs of the scripts where the key can be used.

2016.1

options.label

string

required

The UI label for the field.

2016.1

options.restrictToCurrentUser

Boolean

optional

Controls whether use of this secret key is restricted to the same user that originally entered the key.

By default, the value is false, which means that multiple users can use the key.

If set to true, the secret key applies to a single user.

2016.1

options.container

string

optional

The internal ID of the tab or field group to add the field to. By default, the field is added to the main section of the form.

2016.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/ui/serverWidget Module Script Samples. For a complete script example that uses Form.addSecretKeyField(options), see N/crypto Module Script Samples.

          //Add additional code 
...
var form = serverWidget.createForm({
    title : 'Simple Form'
});
skField = form.addSecretKeyField({
    id : 'password',
    restrictToScriptIds : 'customscript_my_script',
    label : 'Password',
    restrictToCurrentUser : false
});
skField.maxLength = 64;
...
//Add additional code 

        

Related Topics

General Notices