Custom Transaction

You use the custom transaction record to interact with instances of existing custom transaction types. For example, suppose you had a custom transaction type named Non-Operational Income Entry. In this case, you could use SuiteScript to create and modify non-operational income entries.

For help working with this record in the UI, see Custom Transactions.

The internal ID for a custom transaction record varies depending on the ID value of the custom transaction type. For example, if your custom transaction type had an ID value of _noie, the SuiteScript internal ID would be customtransaction_noie. You can view the custom transaction type’s ID value by opening it editing (go to Customization > Lists, Records, & Fields > Transaction Types) and selecting the appropriate type.

See the SuiteScript Records Browser for all internal IDs associated with this record.

Note:

For information about using the SuiteScript Records Browser, see Working with the SuiteScript Records Browser in the NetSuite Help Center.

For information about scripting with records in SuiteScript, see the following help topics:

Supported Script Types

The custom transaction record (instance of a custom transaction type) are scriptable in both client and server SuiteScript.

All three user events are supported: beforeLoad, beforeSubmit, and afterSubmit.

Supported Functions

The custom transaction record is fully scriptable — it can be created, updated, copied, deleted, and searched using SuiteScript.

You use the standard transaction search to search custom transactions. For more information, see Transaction Search.

Custom transactions can be voided if configured to support the void option. Direct voids are never permitted with custom transactions. Only voids through reversal journals are permitted. See transaction.void(options).

Usage Notes

In the UI, custom transactions can have a Status field. In SuiteScript, this field has an internal ID of transtatus. Values for transtatus are set by the system when the statuses are created. They cannot be modified. Possible values are A through Z. In the UI, you can view a transaction type’s available statuses (and their transtatus values) by opening the transaction type and going to the Statuses subtab. The transtatus value for each status is listed in the Code column.

Code Sample

The following sample shows how to create an instance of a custom transaction type.

          var transaction = record.create ({
    type: 'customtransaction_mytype'
});
transaction.setValue ({
    fieldId: 'subsidiary',
    value: '1'
});
// Add debit line 
transaction.selectNewLineItem ({
    sublistId: 'line'
});
transaction.setCurrentSublistValue ({
    sublistId: 'line',
    fieldId: 'account',
    value: '1'
});
transaction.setCurrentSublistValue ({
    sublistId: 'line',
    fieldId: 'debit',
    value: 10
});
transaction.setCurrentSublistValue ({
    sublistId: 'line',
    fieldId: 'credit',
    value: 0
});
transaction.setCurrentSublistValue ({
    sublistId: 'line',
    fieldId: 'memo',
    value: 'My first custom transaction line'
});
transaction.commitLine ({
    sublistId: 'line'
});
// Add credit line 
transaction.selectNewLineItem ({
    sublistId: 'line'
});
transaction.setCurrentSublistValue ({
    sublistId: 'line',
    fieldId: 'account',
    value: '2'
});
transaction.setCurrentSublistValue ({
    sublistId: 'line',
    fieldId: 'debit',
    value: 0
});
transaction.setCurrentSublistValue ({
    sublistId: 'line',
    fieldId: 'credit',
    value: 10
});
transaction.setCurrentSublistValue ({
    sublistId: 'line',
    fieldId: 'memo',
    value: 'My second custom transaction line'
});

transaction.commitLine ({
    sublistId: 'line'
});

transaction.save(); 

        

Related Topics

Custom Transactions
transaction.void(options)
Working with the SuiteScript Records Browser
SuiteCloud Supported Records
Customization

General Notices