SuiteScript 2.x Record Actions and Macros for Automation
SuiteScript 2.x introduces APIs for automating record actions and macros, enhancing productivity by replicating UI button functions programmatically.
SuiteScript 2.x supports APIs that provide the programmatic equivalent of clicking a button in the NetSuite user interface. The record action and macro APIs allow developers to run the same business logic as a UI button click. This capability can significantly enhance productivity by automating routine tasks previously requiring manual interaction in the UI.
How Do Record Actions and Macros Work?
NetSuite records offer two methods for executing native logic: either through direct UI interaction or by running scripts that utilize the corresponding API for the action. Both approaches yield the same results, but utilizing SuiteScript's macro and action APIs can simplify scripting and enhance flexibility.
Record Actions
Record actions allow for the convenient updating of one or more records currently in view mode. The changes made by these actions are immediately saved in the database without needing to check for required roles or permissions, since the necessary conditions for execution are pre-embedded in the action API. This characteristic allows for efficient handling of multiple records, such as approval or rejection actions. For example, when an approve action is executed on a record, the approval status is instantly recorded.
Record Macros
Conversely, record macros automate the execution of business logic during the editing of a record. Unlike record actions, changes made through a macro are not saved until the record itself is saved. For instance, a macro can provide a preview of the calculated tax amount for items in a sales order after entering details, but this information is not finalized until the user saves the record.
Benefits of Using Record Actions and Macros
- Reduced Governance Usage: By executing complex business logic via a single API call, you minimize governance charges compared to multiple API calls associated with traditional logic execution methods.
- Automation of Complexity: Handle intricate processes effortlessly without manually navigating UI elements.
- Flexibility: Apply the same logic consistently across various scripting contexts, making wider applicability achievable.
Supported Record Macros
Macros are categorized by record type, each with its UI button labels. Here’s a list of currently supported record macros:
| Record Type | Macro ID | UI Button Label |
|---|---|---|
| Billing Rate Card | modifyPriceByPercent | Recalculate |
| Project Charge Rule | copyResources | Copy Resources from Tasks |
| Project Work Breakdown Structure | getAmountFieldValue | Get Amount Field Value |
| Project Work Breakdown Structure | getAmountsFields | Get Amounts Fields |
| Project Work Breakdown Structure | getUnmatchedActuals | Get Unmatched Actuals |
| Project Work Breakdown Structure | setAmountFieldValue | Set Amount Field Value |
| Sales Order | autoAssignLocations | Auto Assign Locations |
| Transaction Record | calculateTax | Preview Tax |
| Transaction Record | getSummaryTaxTotals | Get Summary Tax Totals |
With these APIs, SuiteScript 2.x empowers developers to create more efficient and automated solutions, further enhancing the capabilities of the NetSuite platform.
Source: This article is based on Oracle's official NetSuite documentation.
Frequently Asked Questions (4)
Do record actions in SuiteScript 2.x require checking for user roles or permissions?
When using record macros in SuiteScript 2.x, are changes immediately saved to the database?
Which SuiteScript 2.x feature allows for the automation of business logic during record editing?
Does using SuiteScript 2.x record actions and macros reduce governance charges?
Was this article helpful?
More in Integration
- Natural Language Queries in NetSuite AI
MCP Standard Tools SuiteApp enables AI-driven data tasks in NetSuite, aligned with role permissions.
- Square Connector Integration in NetSuite 2026.1
Discover the Square Connector for seamless integration with NetSuite 2026.1, synchronizing transactions, orders, and inventory effortlessly.
- SuiteTalk Web Services Updates for NetSuite Integrations
SuiteTalk Web Services adds new Item Supply Plan support, enhancing integrations for efficient data management.
- SuiteTalk Web Services Enhancements in NetSuite
Explore the latest enhancements to SuiteTalk Web Services, improving integration and API functionalities in NetSuite.
Advertising
Reach Integration Professionals
Put your product in front of NetSuite experts who work with Integration every day.
Sponsor This Category