Transactions

Note:

Processed lines for this transaction type contribute to the Monthly Transaction Lines metric that counts toward maximum limits for your NetSuite service tier. For more information, see Transaction Types Included in Transaction Types Included in Monthly Transaction Lines Metric.

A macro can be used for taxable transactions. For more information, see Transaction Record Macros.

The following transaction records are scriptable in SuiteScript.

Transaction Record Macros

The calculateTax and getSummaryTaxTotals macros can only be used for the following taxable transactions, if the SuiteTax feature is enabled. If a macro is executed on a non-taxable transaction or the SuiteTax feature is not enabled, an error occurs.

calculateTax

Macro Description

Calculates taxes on a transaction, same as when a user clicks the Preview Tax button in the UI. Taxes are always calculated when the transaction is saved.

Returns

void

Supported Script Types

Client and server scripts

For additional information, see SuiteScript 2.x Script Types.

Since

2016.1

Parameters

See Record.executeMacro(options) for details about parameters required for the execution of any macro.

Errors

Error Code

Thrown If

SSS_UNSUPPORTED_METHOD

The SuiteTax feature is disabled, or the transaction type of the current record is non-taxable.

SSS_TAX_REGISTRATION_REQUIRED

The subsidiary of the current record does not have a valid tax registration.

Transaction calculateTax Macro Syntax

                require(['N/currentRecord'],function(currentRecord){

    currentRecord.executeMacro({id:'calculateTax'});

}); 

              

For an example of how to call the calculateTax macro on a sales order record, see Call a Macro on a Sales Order Record.

getSummaryTaxTotals

Macro Description

Checks whether tax is calculated, iterates through tax details, and gathers all tax type IDs

Returns

An object that contains notification and response, which contains the taxTotals array

Supported Script Types

Client and server scripts

For additional information, see SuiteScript 2.x Script Types.

Since

2019.1

Parameters

See Record.executeMacro(options) for details about parameters required for the execution of any macro.

Errors

Error Code

Thrown If

SSS_UNSUPPORTED_METHOD

The SuiteTax feature is disabled, or the transaction type of the current record is non-taxable.

SSS_TAX_REGISTRATION_REQUIRED

The subsidiary of the current record does not have a valid tax registration.

Transaction getSummaryTaxTotals Macro Syntax

                require(['N/currentRecord'], function(currentRecord){

    var taxTotals = currentRecord.executeMacro({id:'getSummaryTaxTotals'});

}); 

              

Sample Return Objects

                {

    taxTotals: [

        {

            taxTypeId: 123,

            taxTypeName: 'VAT Standard',

            taxTotal: '833.33'

        },

        {

            taxTypeId: 124,

            taxTypeName: 'VAT Reduced',

            taxTotal: '1.99'

        }

    ]

} 

              

General Notices