Key Object Members of keyControl in SuiteScript

The keyControl module in SuiteScript provides essential member properties and methods for managing keys within NetSuite scripts.

·2 min read·View Oracle Docs

The keyControl module in SuiteScript provides developers with mechanisms to create and manage keys programmatically. This article outlines the key object members available and their specific descriptions, return types, and supported script types.

What Are Key Object Members?

Key object members are properties and methods associated with the keyControl.Key object in SuiteScript. These members allow you to interact with keys used within NetSuite servers.

Key Object Members Overview

The following table summarizes the key object members, their types, and descriptions:

Member NameTypeDescriptionSupported Script Types
Key.filefile.FileRepresents the file object of the key.Server scripts
Key.passwordstringContains the password for the key (write-only).Server scripts
Key.scriptIdstringScript ID of the key, prefixed with custkey.Server scripts
Key.namestringName of the key.Server scripts
Key.descriptionstringDescription associated with the key.Server scripts
Key.restrictionsstringInternal IDs of the employees restricted to this key.Server scripts

Methods

The method available for this object is:

  • Key.save(): This method is used to save the key. Its return type is an object.

Example Usage

To create and modify a key using the keyControl module, you might use the following code snippet:

suitescript
1// Add additional code
2...
3var key = keyControl.createKey();
4key.file = file.load(422); // ID of the file containing the private key (id_ecdsa or id_rsa)
5...
6// Add additional code

Conclusion

The keyControl module plays a crucial role in securely managing keys within SuiteScripts. By familiarizing yourself with the key object members, you can effectively utilize keys to enhance your integration scripts.

Source: This article is based on Oracle's official NetSuite documentation.

Key Takeaways

  • The keyControl.Key object allows for management of keys in SuiteScript.
  • Key members include file, password, script ID, and restrictions.
  • The Key.save() method is crucial for saving changes to the key.

Frequently Asked Questions (4)

What script types are supported by the keyControl module in SuiteScript?
The keyControl module supports server scripts for all key object members.
Can the password for a key in the keyControl module be read programmatically?
No, the password property for a key in the keyControl module is write-only.
What information does the Key.restrictions property provide?
The Key.restrictions property contains the internal IDs of the employees restricted to the key.
How do you save changes to a key using the keyControl module?
You save changes to a key using the Key.save() method, which returns an object.
Source: Key Object Members Oracle NetSuite Help Center. This article was generated from official Oracle documentation and enriched with additional context and best practices.

Was this article helpful?

More in General

View all General articles →