keyControl.createKey(options)
Method Description |
Creates a key record on the Keys page using a file from the File Cabinet. |
Returns |
|
Governance |
10 units |
Module |
|
Since |
2019.2 |
Parameters
The options
parameter is a JavaScript object.
Parameter |
Type |
Required / Optional |
Description |
Since |
---|---|---|---|---|
|
file |
required |
The internal ID of the File Cabinet file with the key. The key must be in PEM format. |
2019.2 |
|
string |
required |
The name of the key. |
2019.2 |
|
string |
optional |
The description of the key. |
2019.2 |
|
string |
optional |
The password that is associated with the key. The script ID of an API secret is accepted for this value. For more information, see Secrets Management. |
2019.2 |
|
string |
optional |
The script ID for the newly-created key. NetSuite prepends this ID with ‘custkey’. If you do not provide an ID, one is auto-generated. |
2019.2 |
|
number[] or string[] |
optional |
The array of employee internal IDs selected in the Restricted to Employees field for a key. If you select employees, only those employees can use this key. |
2019.2 |
Syntax
The following code sample shows the syntax for this member. It is not a functional example. For a complete script example, see N/keyControl Module Script Samples.
// Add additional code
...
require(['N/keyControl','N/file'],function(keyControl,file){
var key = keyControl.createKey();
key.file = file.load(422);
//id of file containing private key (id_ecdsa or id_rsa)
key.name = "SFTP key";
key.save();
})
...
// Add addtional code