Notes on the NetSuite CustomerDeposit Record
Table of Contents
In the past, I worked a lot with the NetSuite CustomerDeposit record. Like most things in NetSuite, there are many nuances that can waste a lot of your time.
Here are some the things I learned:
- Searching for CustomerDeposits with the
_customerDepositNotDeposited
status will not return results that cannot be deposited, but it will not return all deposits that can be deposited. - When a CustomerDeposit is applied against an Invoice or a CustomerRefund, a DepositApplication record is created. The
deposit
field links to the CustomerDeposit. There is anapplyList
which applies the deposit to invoices or customer refunds. - When a DepositApplication is created the status of a CustomerDeposit shifts to FullyApplied.
- If a CustomerDeposit is associated with a Deposit record, the status shifts to Deposited. However, if the CustomerDeposit has also been associated with a Deposit application, the status will remain at "Fully Applied." This status overrides the "Deposited" status.
- There is not way to determine if a CustomerDeposit record has been associated with a deposit record from the record itself.
- You can search for a Deposit with a
appliedToTransaction
search pointing to the CustomerDeposit to determine if the CustomerDeposit has been associated with a Deposit. - You can also run an advanced search on the CustomerDeposit listing
depositTransaction
as a search result column to determine if a CustomerDeposit is deposited. If thedepositTransaction
exists then it the CustomerDeposit has already been deposited. Note that you cannot search for CustomerDeposits that do not have this defined.
Here’s an example, using the NetSuite ruby gem (here’s a solid python library) of how to find the Deposit connected to a given CustomerDeposit:
ns_customer_deposit_internal_id = 123
deposit_search = NetSuite::Records::Deposit.search(
criteria: {
basic: [
{
field: 'type',
operator: 'anyOf',
value: [ '_deposit' ]
},
{
field: 'appliedToTransaction',
operator: 'anyOf',
value: [
NetSuite::Records::RecordRef.new(internal_id: ns_customer_deposit_internal_id)
]
}
]
},
# only return internal ID to speed up the query, omit if you want full record data
columns: {
'tranSales:basic' => [
'platformCommon:internalId/' => {},
]
}
)