keyControl.lock(options)
Method Description |
Locks a key that has been uploaded to the Private Keys list in the UI or created using keyControl.createKey(options). Locked keys cannot be edited in the UI until they are unlocked with keyControl.unlock(options). For more information, see Locking and Restricting Certificates. |
Returns |
void |
Supported Script Types |
Server scripts For additional information, see SuiteScript 2.x Script Types. |
Governance |
10 units |
Module |
|
Since |
2021.1 |
Parameters
The options
parameter is a JavaScript object.
Parameter |
Type |
Required / Optional |
Description |
Since |
---|---|---|---|---|
|
string |
required |
The script ID or internal ID for the key you want to lock. You can view the ID of a key from the Private Keys list at Setup > Company > Keys. |
2021.1 |
Errors
Error |
Thrown If |
---|---|
|
The key with the ID provided does not exist in this account. |
|
The current employee or script does not have permission to access or edit the key. This can happen if the key is restricted to specific scripts or employees on the key record using the Restrict to Scripts or Restrict to Employees fields. |
|
The key has already been locked. |
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
...
//load the key object
var loadedKey = keyControl.loadKey({
scriptId : 'custkey_testid'
});
//lock the key
loadedKey.lock({
id: 'custkey_testid'
});
///save the key
loadedKey.save();
...
// Add additional code