Overview of Record Action and Macro APIs

NetSuite records offer two alternatives for executing native NetSuite logic: a user either clicks a UI button or runs a script that calls the API corresponding to the button. These script and UI alternatives both produce the same results. Macro and action APIs provide ease and flexibility for your scripting. These APIs are supported for all SuiteScript 2.0 client and server script types. Macro and action APIs also can lower governance usage because they can execute complex business logic in one API call instead of multiple API calls. For actions, governance is charged per individual action executed, and varies depending on the type of action. For macros, no governance is charged, because changes executed by macros are saved as part of record submits.

Record actions provide a convenient way to update the state of one or more records that are in view mode. Changes that the execution of an action API makes to records are persisted in the database immediately. It is not necessary to take into account required roles, permissions, or other conditions for a record action to execute. The conditions required to execute an action are embedded in the record action API. If the conditions are not met, the action does not execute. Approve and reject are two example use cases for record actions. These actions can be applied to a single record or to multiple records of the same type, as a bulk process. When an approve or reject action is executed on a record, the approval status of the record is saved immediately.

Record macros provide an automated way to execute business logic on a record as it is edited. Changes that the execution of a macro API makes to a record are not persisted until the record is saved. An example use case for a record macro is a preview of the calculated tax amount for a sales order’s items. This macro API executes after items are entered on a sales order. It results in the display of the calculated tax amount on the sales order. However, the tax amount is not saved until the record is saved. A macro API is applied only to one single record at a time. After changes to the record are saved, changes to other dependent records may occur as a result.

You need to use two different types of APIs to call record macros and actions in your scripts:


For information about working with record actions in REST web services, see Executing Record Actions.

Related Topics

SuiteScript 2.x
SuiteScript 2.x API Introduction
SuiteScript 1.0 to SuiteScript 2.x API Map
SuiteScript 2.x Script Types
SuiteScript 2.x Global Objects
SuiteScript 2.x Modules
SuiteScript 2.x JSDoc Validation
SuiteScript 2.x Entry Point Script Creation and Deployment
SuiteScript 2.x Custom Modules
SuiteScript 2.x Scripting Records and Subrecords
SuiteScript 2.x Custom Pages

General Notices