ToolParameter Object Members in SuiteScript 2.1
The ToolParameter object allows developers to define parameters for server scripts, enhancing script functionality and flexibility.
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 Name | Return Type | Supported Script Types | Description |
|---|---|---|---|
| ToolParameter.description | string | Server scripts | The description of the tool parameter. |
| ToolParameter.name | string | Server scripts | The name of the tool parameter. |
| ToolParameter.type | string | Server scripts | The type of the tool parameter. |
Property Details
- description: A
stringthat provides a description of the tool parameter to enhance clarity and usability. - name: A
stringthat indicates the name assigned to the parameter. - type: A
stringthat specifies the type of the parameter, such asSTRINGor 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:
1// Create a tool parameter2const userNameParameter = llm.createToolParameter({3 name: "userName",4 description: "Name of the user",5 type: llm.ToolParameterType.STRING6});7 8// Accessing parameter properties9const 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.
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?
Can ToolParameter properties be modified after initial assignment?
How can I define the type of a tool parameter in SuiteScript?
What is the purpose of the ToolParameter.description property?
Was this article helpful?
More in SuiteScript
- Common SuiteScript Errors and Solutions for NetSuite
Common NetSuite script errors include INVALID_SCRIPT_DEPLOYMENT_ID and SSS_AUTHORIZATION_HEADER_NOT_ALLOWED. Learn effective solutions.
- Set Sublist Field Values in SuiteScript 2.x for Record Management
Set sublist field values in SuiteScript 2.x for effective record management using standard and dynamic modes.
- Setting Field Values in SuiteScript for Effective Record
Learn to set field values in SuiteScript effectively, troubleshooting common errors and understanding data types.
- SuiteScript 2.1 Enhancements and API Updates in NetSuite
SuiteScript 2.1 enables execution of 2.0 scripts and supports PATCH method for enhanced API capabilities.
Advertising
Reach SuiteScript Professionals
Put your product in front of NetSuite experts who work with SuiteScript every day.
Sponsor This Category