Modules

filter

 

Objects/Functions

module (N/ui/serverWidget)

SuiteScript 2.0

Form.addCredentialField(options)

{Form}.addCredentialField({id: {string*},label: {string*},restrictToDomains: {string | string[]*},restrictToScriptIds: {string | string[]*},restrictToCurrentUser: {boolean},container: ${7:string}})

N/ui/serverWidget Module
Form.addCredentialField()
Method Description: Adds a text field that lets you store credentials in NetSuite to be used when invoking services provided by third parties. The GUID generated by this field can be reused multiple times until the script executes again. For example, when executing credit card transactions, merchants need to store credentials in NetSuite that are used to communicate with Payment Gateway providers. The credentials added with this method can be used with the N/sftp Module and the N/https Module. Note the following about this method: Credentials associated with this field are stored in encrypted form. No piece of SuiteScript holds a credential in clear text mode. NetSuite reports or forms will never provide to the end user the clear text form of a credential. Any exchange of the clear text version of a credential with a third party must occur over SSL. For no reason will NetSuite ever log the clear text value of a credential (for example, errors, debug message, alerts, system notes, and so on). Decryption occurs though the scripts listed in the restrictToScriptIds parameter. These scripts can call https.createSecureString(options) to decrypt the GUID and create a SecureString instance. The default maximum length for a credential field is 32 characters. If needed, use the Field.maxLength property to change this value.
Returns: serverWidget.Field object
Supported Script Types: SuiteScript 2.0 Suitelet Script Type and SuiteScript 2.0 User Event Script Type (beforeLoad(scriptContext))
Governance: None
Module: N/ui/serverWidget Module
Since: 2015.2
Search NetSuite - https://system.netsuite.com/app/help/helpcenter.nl?search=Form.addCredentialField(options)

Example:

// Code Example 1
//Add additional code
//...
var form = serverWidget.createForm({
title : 'Simple Form'
});
var credField = form.addCredentialField({
id : 'username',
label : 'Username',
restrictToDomains : 'www.mysite.com',
restrictToScriptIds : 'customscript_my_script',
restrictToCurrentUser : false,
});
credField.maxLength = 64;
//...
//Add additional code

//SOURCE: https://system.netsuite.com/app/help/helpcenter.nl?fid=section_4337770901.html