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.
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?
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 Platform
- Style Object Members for Workbook API in NetSuite
The Style object provides customizable properties for workbook formatting in NetSuite, enhancing report and visualization functionality.
- Asynchronous HTTP Requests with SuiteScript Promises
Use SuiteScript to send asynchronous HTTP requests with promises for efficient error handling and response processing.
- Setting Sublist Field Values in SuiteScript
Set values for sublist fields in SuiteScript using the setSublistValue method. Understand required parameters and error handling.
- In This Help Topic
Explore N/log module guidelines, log levels, and script execution logs for efficient logging in SuiteScript.
Advertising
Reach Platform Professionals
Put your product in front of NetSuite experts who work with Platform every day.
Sponsor This Category