Deposit
You use the deposit record to adjust the balance of an account.
In the UI, you access this record at Transactions > Bank > Make Deposits.
For help working with this record in the UI, see Deposits.
The internal ID of this record is deposit
.
See the SuiteScript Records Browser for all internal IDs associated with this record.
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 this record in SuiteScript, see the following help topics:
Supported Script Types
The deposit record is scriptable in both client and server SuiteScript.
All three user events are supported: beforeLoad, beforeSubmit, and afterSubmit.
Supported Functions
The deposit record cannot be copied, but otherwise it is fully scriptable. It can be created, updated, deleted, and searched in SuiteScript.
Usage Notes
Be aware of the following:
-
To successfully add a new deposit record, you must include at least one line in one of the following three sublists:
-
Payments
-
Other Deposits
-
Cash Back
-
-
If you use the Multi-Book Accounting feature, be aware that the Accounting Book Detail sublist is read-only and not scriptable.
-
In some cases, you must specify the lineId when depositing payments to ensure the correct lineId is used and avoid the RCRD_HAS_BEEN_CHANGED error. In particular, journal entries can have a lineId that is not 0. If a journal entry is loaded in the line, you are adding paymentId. Therefore you must explicitly set the lineId.
Code Samples
The following sample shows how to create, load, and delete deposit records.
function createBankDeposit(cashSaleId){
var deposit = record.create({
type: record.Type.DEPOSIT
});
deposit.setValue({
fieldId: 'account',
value: '1'
});
deposit.setValue({
fieldId: 'subsidiary',
value: '1'
});
deposit.setSublistValue({
sublistId: 'payment',
fieldId: 'id',
line: 1,
value: cashSaleId // replace this with a valid id
});
deposit.setSublistValue({
sublistId: 'payment',
fieldId: 'deposit',
line: 1,
value: 'T'
});
var recordId = deposit.save();
return recId;
}
function testDeposit() {
var cashSaleId = null;
var depositId = null;
try{
cashSaleId = createCashSale(); // or type internalId of valid Cash Sale
depositId = createBankDeposit(cashSaleId);
var testdeposit = record.load({
type: record.Type.DEPOSIT,
id: depositId
});
}
finally {
if (depositId != null) {
record.delete({
type: record.Type.DEPOSIT,
id: depositId
})
}
if (cashSaleId!= null) {
record.delete({
type: record.Type.CASH_SALE,
id: cashSaleId
})
}
}
}
Disabling or Enabling User Filters
When you create or load a deposit record, you can control whether the script respects the filter preferences set by the user on the record’s Deposits > Payments subtab. You control this behavior by using the disablepaymentfilters
initialization flag.
Set the parameter to true
to ignore the preferences and disable filters, so that all the payments are loaded.
Set the parameter to false
to indicate that the system should respect the user’s preferences and enable the filters. In this case, filters are applied and fewer payments are loaded. If you have a large number of payments, you can set disablepaymentfilters
to false
to improve performance. If you do not set a value for the disablepaymentfilters
parameter, it defaults to false.
Disabling Filters in SuiteScript 2.x
In SuiteScript 2.x, you can interact with disablepaymentfilters
when you use the defaultValues parameter, which is available for the record.create(options) and record.load(options).
For example, the following SuiteScript 2.x snippet would ignore the user’s preferences:
var newRecord = record.create({
type: record.Type.DEPOSIT,
defaultValues: {
account: '2',
disablepaymentfilters: true
}
});
Specifying Payment IDs
When you create a deposit record, you can choose to specify payment IDs. You control this behavior by using the deposits
initialization parameter.
Specifying Payment IDs in SuiteScript 2.x
To specify payment IDs in SuiteScript 2.x, use the deposits
initialization parameter, which is available for record.create(options). The deposits
parameter is not available for record.load(options).
For example, the following SuiteScript 2.x snippet would select the payment IDs of 818 and 819:
var myDeposit = record.create({
type: record.Type.DEPOSIT,
defaultValues: {
'deposits': '818,819'
}
});