ToolParameter Object Members in SuiteScript 2.1

The ToolParameter object allows developers to define parameters for server scripts, enhancing script functionality and flexibility.

·2 min read·View Oracle Docs

The ToolParameter object is an essential part of SuiteScript 2.1, allowing developers to create parameters that can be used in server scripts. This article delves into its members, illustrating how they can be leveraged to improve script functionality.

What are ToolParameter Object Members?

The ToolParameter object consists of several properties that define parameters in server scripts. Here are the key members:

Member NameReturn TypeSupported Script TypesDescription
ToolParameter.descriptionstringServer scriptsThe description of the tool parameter.
ToolParameter.namestringServer scriptsThe name of the tool parameter.
ToolParameter.typestringServer scriptsThe type of the tool parameter.

Property Details

  • description: A string that provides a description of the tool parameter to enhance clarity and usability.
  • name: A string that indicates the name assigned to the parameter.
  • type: A string that specifies the type of the parameter, such as STRING or other appropriate types available within SuiteScript.

Error Handling

When using the ToolParameter properties, developers should note that attempting to set any of these properties after their initial assignment will lead to a READ_ONLY error.

Example Syntax

To illustrate how the ToolParameter object members can be utilized, consider the following example:

suitescript
1// Create a tool parameter
2const userNameParameter = llm.createToolParameter({
3 name: "userName",
4 description: "Name of the user",
5 type: llm.ToolParameterType.STRING
6});
7
8// Accessing parameter properties
9const toolParameterDescription = userNameParameter.description;

This code sample demonstrates creating a ToolParameter and accessing its description.

Summary

The ToolParameter object is an integral part of developing server scripts in SuiteScript 2.1, allowing for enhanced parameter management and improved script interactions. Properly understanding its members and usage patterns will equip developers with the ability to write more flexible and powerful scripts.

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

Key Takeaways

  • The ToolParameter object is crucial for defining parameters in server scripts.
  • Each member of ToolParameter enhances clarity and script functionality.
  • Incorrect attempts to modify property values result in READ_ONLY errors.

Frequently Asked Questions (4)

What script types support ToolParameter object members in SuiteScript 2.1?
ToolParameter object members are supported in server scripts within SuiteScript 2.1.
Can ToolParameter properties be modified after initial assignment?
No, attempting to set ToolParameter properties after they are initially assigned will lead to a READ_ONLY error.
How can I define the type of a tool parameter in SuiteScript?
You can define the type of a tool parameter using the 'type' property, specifying it as a string like 'STRING' which denotes the parameter type.
What is the purpose of the ToolParameter.description property?
The ToolParameter.description property provides a string description to enhance the clarity and usability of the tool parameter within scripts.
Source: ToolParameter 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 Platform

View all Platform articles →