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
- SuiteScript 2.1 Enhancements in NetSuite February Updates
SuiteScript 2.1 now supports async features and PATCH method. Discover the latest API and SuiteProcurement improvements.
- Scheduling Map/Reduce Script Deployments in NetSuite
Learn to schedule map/reduce script submissions, including one-time and recurring options in NetSuite.
- Binary File Support in N/https Module for SuiteScript
SuiteScript enhances capabilities with binary file support in the N/https module, allowing improved data handling in external communications.
- API Governance Units Calculation in NetSuite 2026.1
NetSuite 2026.1 introduces examples illustrating API governance unit calculations for both user event and scheduled scripts.
