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.
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 8"text-purple-400">define([], "text-purple-400">function() {9 10"text-purple-400">return {11 12add: "text-purple-400">async "text-purple-400">function (args) {13 "text-purple-400">try {14 "text-purple-400">const a = args["a"];15 "text-purple-400">const b = args["b"];16 "text-purple-400">return { result: a + b };17 } "text-purple-400">catch(e) {18 "text-purple-400">return { result: "", error: "There was an error executing the tool: " + e };19 }20},21 22reverseText: "text-purple-400">async "text-purple-400">function (args) {23 "text-purple-400">try {24 "text-purple-400">const text = args["text"];25 "text-purple-400">return { result: text.split('').reverse().join('') };26 } "text-purple-400">catch(e) {27 "text-purple-400">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
- N/https Module: Binary File Support in NetSuite 2025.2
NetSuite 2026.1 adds binary file support to N/https for streamlined file handling.
- 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.
- Attach and Detach Operations in NetSuite 2026.1
Attach and detach operations for record relationships in NetSuite enhance data management and connectivity.
- Create-Form Operation in NetSuite 2026.1 REST Web Services
Create-form operation in NetSuite 2026.1 APIs streamlines record creation and enhances efficiency.
Also from NetSuite 2026.1
- Custom Labels for Additional Item Prices in NetSuite 2026.1
Custom labels enhance transaction summaries in NetSuite, improving clarity for item prices.
- Applied Trans Date and Period Enhancements in NetSuite 20...
Latest updates in NetSuite 2024.1 enhance Accounting SuiteApps with transaction line distribution features.
- Data Not Copied from Production to Sandbox in NetSuite 2026.1
In NetSuite 2026.1, key data like domains and customer roles are not copied to sandbox accounts during refreshes, impacting setup.
- Available Items Only Feature in NetSuite 2026.1
Available items only filtering boosts sales efficiency in NetSuite 2026.1 with Intelligent Item Recommendations.
Advertising
Reach SuiteScript Professionals
Put your product in front of NetSuite experts who work with SuiteScript every day.
Sponsor This Category