Custom Tool Script for Adding Numbers and Reversing Strings
NetSuite 2026.1 introduces a Custom Tool Script for adding numbers and reversing strings, enhancing SuiteScript capabilities.
Starting in NetSuite 2026.1, a custom tool script has been introduced that allows developers to implement two useful functionalities: adding two numbers and reversing a given string. This enhancement makes it easier for developers to create customized tools directly within the NetSuite environment, improving user workflows and providing additional support for various scripting needs.
Overview of the Custom Tool Script
The provided sample script is written in SuiteScript 2.1, a modern version of NetSuite's JavaScript API. This custom tool script consists of two main functions:
- Add: Takes two numeric inputs and returns their sum.
- ReverseText: Accepts a string and returns the string with its characters reversed.
Sample Code Explanation
Here is a detailed view of the code for the custom tool script:
1/**2 * exampletools.js3 * @NApiVersion 2.14 * @NModuleScope Public5 * @NScriptType CustomTool6 */7 8define([], function() {9 10return {11 12add: async function (args) {13 try {14 const a = args["a"];15 const b = args["b"];16 return { result: a + b };17 } catch(e) {18 return { result: "", error: "There was an error executing the tool: " + e };19 }20},21 22reverseText: async function (args) {23 try {24 const text = args["text"];25 return { result: text.split('').reverse().join('') };26 } catch(e) {27 return { result: "", error: "There was an error executing the tool: " + e };28 }29}30 31}32});Important Notes
- The script utilizes the
define()function for module loading, which is essential for entry point scripts linked to script records. - To test this script in the SuiteScript Debugger, use the
require()function instead. - SuiteScript 2.1 supports multiple modern JavaScript features, which enhance script performance and capabilities.
Who This Affects
This new functionality impacts:
- Developers: Who can enhance their applications with additional custom logic directly through tools.
- Administrators: In managing and deploying these scripts within the NetSuite environment.
Key Takeaways
- NetSuite 2026.1 introduces a Custom Tool Script that helps add numbers and reverse strings.
- The script is built using SuiteScript 2.1, leveraging modern JavaScript features for better functionality.
- It simplifies the creation of customized scripts tailored to meet specific business needs.
- Developers can directly implement and deploy these tools in their workflows, enhancing operational efficiency.
Frequently Asked Questions (4)
Do I need to enable any feature flags to use the Custom Tool Script for adding numbers and reversing strings?
Is the Custom Tool Script available for all editions of NetSuite?
What is the purpose of using the 'define()' function in this Custom Tool Script?
Can the script handle errors when adding numbers or reversing strings?
Weekly Update History (1)
Updated SuiteScript 2.1 Custom Tool Script Type Code Samples to include updated code and schema samples.
View Oracle DocsWas 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.
Also from NetSuite 2026.1
- Custom Tool Script Enhancements in NetSuite
NetSuite 2026.1 enhances custom tool scripts with execution logs, a new management page, and binary file support. TL;DR Opening
- Unlimited Sandbox Refreshes in NetSuite 2026.1
Starting in NetSuite 2026.1, sandbox accounts can be refreshed an unlimited number of times, enhancing testing capabilities.
- Enriched Bank Data for Improved Transaction Matching in NetSuite
Updated for NetSuite 2026.1: Enriched Bank Data feature enhances transaction matching accuracy using generative AI.
- Natural Language Queries in NetSuite AI
Updated for NetSuite 2026.1, featuring enhancements in natural language queries. The MCP Standard Tools SuiteApp offers enhanced AI-driven interaction with
