Custom Tool Script for Adding Numbers and Reversing Strings in

NetSuite 2026.1 introduces a Custom Tool Script for adding numbers and reversing strings, enhancing SuiteScript capabilities.

·2 min read·2 views·NetSuite 2026.1·View Oracle Docs

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:

/**
 * exampletools.js
 * @NApiVersion 2.1
 * @NModuleScope Public
 * @NScriptType CustomTool
 */

define([], function() {

return {

add: async function (args) {
    try {
        const a = args["a"];
        const b = args["b"];
        return { result: a + b };
    } catch(e) {
        return { result: "", error: "There was an error executing the tool: " + e };
    }
},

reverseText: async function (args) {
    try {
        const text = args["text"];
        return { result: text.split('').reverse().join('') };
    } catch(e) {
        return { result: "", error: "There was an error executing the tool: " + e };
    }
}

}
});

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?
The article does not specify the need to enable any feature flags for using this Custom Tool Script. It is part of NetSuite 2026.1 and utilizes SuiteScript 2.1.
Is the Custom Tool Script available for all editions of NetSuite?
The article does not mention whether the Custom Tool Script is available in all NetSuite editions. It is introduced in NetSuite 2026.1.
What is the purpose of using the 'define()' function in this Custom Tool Script?
The 'define()' function is used for module loading, which is essential for entry point scripts linked to script records in SuiteScript 2.1.
Can the script handle errors when adding numbers or reversing strings?
Yes, the script includes error handling for both the add and reverseText functions, returning an error message if an exception occurs during execution.

Weekly Update History (1)

SuiteScriptupdated

Updated SuiteScript 2.1 Custom Tool Script Type Code Samples to include updated code and schema samples.

View Oracle Docs
Source: Custom Tool Script that Adds Numbers and Reverses a String Oracle NetSuite Help Center. This article was generated from official Oracle documentation and enriched with additional context and best practices.

Was this article helpful?