Executing Record Actions

REST web services support APIs that provide the programmatic equivalent of clicking a button in the NetSuite user interface. With the record action APIs, you can use REST web services to trigger the same business logic that is triggered by the click of a UI button. Record actions can increase productivity by automating regular tasks that previously had to be done manually in the UI.

By using record actions, you can update the state of a record. Approve and reject are two examples of record actions. When an approve or reject action is executed on a record, the approval status of the record is saved immediately.

REST web services support the same record actions supported by SuiteScript.

For a list of supported actions, see Supported Record Actions.

Metadata is not provided for record actions.

You can call record actions using the HTTP POST method on the record instance. The action name is prefixed with the string "@".

Action parameters can be passed in the request body in the JSON object.

The following is an example of a record action call with action parameters in the request body.

          POST http://demo123.suitetalk.api.netsuite.com/services/rest/record/v1/vendorPayment/3/@confirm
{
   "confirmationDate": "2019-1-31",
   "exchangeRate": "4.2",
   "postingPeriod": 348
 } 

        

You can also execute record actions without providing action parameters, as in the following example.

          POST http://demo123.suitetalk.api.netsuite.com/services/rest/record/v1/vendorPayment/3/@confirm 

        

If an action is performed successfully, the HTTP 200 response is returned.

          HTTP/1.1 200 OK
Content-Type: application/vnd.oracle.resource+json; type=singular
{
  "links": [
    "self": "http:/demo123.suitetalk.api.netsuite.com/services/rest/record/v1/vendorPayment/3/@confirm"
  ],
  "result": true
} 

        

When a record action cannot be executed, an HTTP 4xx response is returned.

          HTTP/1.1 400 Bad Request
Content-Type: application/vnd.oracle.resource; type=error
{
    "type": "https://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html",
    "title": "Payment already declined",
    "detail": "A payment you are trying to decline is already declined",
    "status": 400,
    "o:errorCode": "USER_ERROR"
} 

        

Related Topics

The REST API Browser
NetSuite Record Structure
Using CRUD Operations on Custom Records, Custom Lists, and Custom Transactions v1
Creating a Record Instance
Getting a Record Instance
Updating a Record Instance
Using the Upsert Operation
Deleting a Record Instance
Accessing Subresources in REST Web Services
Using External IDs
Using Datetime Fields
Transforming Records
Working with the Pricing Sublist on Item Records
Using the REST Web Services SuiteScript Execution Context

General Notices