Finding the NetSuite Deposit Associated with a Payment or Refund

Determining which NetSuite deposit record is associated with a customer payment, customer refund, cash payment, cash refund, etc using SuiteTalk is not straightforward. It’s also challenging to determine if a refund record is still available to be deposited. Payment transactions have a status field which indicates if a record has been deposited or not, but refund records do not have this field.

In order to determine if a refund is deposited, you need to search for an associated deposit. Here’s a sample implementation using the NetSuite ruby bindings:

ns_customer_refund_id = 2158604

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_refund_id) ]
      },
    ]
  },
  preferences: {
    page_size: 10
  }
)

ns_deposit = search.results.first

# deposit needs to be refreshed to include body fields
ns_deposit.refresh

Linking to the Associated Deposit in the NetSuite GUI

Another way to solve this problem is creating a custom field on the refund record and use a formula to pull the associated deposit from the refund. NetSuite stores a reference to the deposit in their refund DB table that is not exposed to SuiteTalk or SuiteScript. Here’s more details on this pulled from a conversation with NetSuite support:

I created a custom body field on Customer Refund page to display the associated Bank Deposit Number as steps listed below.

  1. Navigate to Customization > Lists, Records, & Fields > Click on Transaction Body Fields > New.

  2. Enter a Label for the custom field. For example, Bank Deposit Number (Test).

  3. Type field: select ‘Free-Form Text’

  4. Store Value checkbox > Unchecked.

  5. Under Applies To tab > Check ‘Sales’

  6. Under Display tab > Subtab > I selected ‘Main’

  7. Under Validation&Defaulting tab > Default Value field > Enter ‘{deposittransaction.number} ‘

  8. Save.

  9. Navigate to Customization > Forms > Transaction Forms > Edit the Customer Refund transaction form in concern/in use > Under Screen Fields tab > Main Subtab > Make sure that the above custom field created is checked with ‘Show’ checkbox > Save.

Now, if you open/view an existing Customer Refund transaction that is associated with a Bank Deposit, the Bank Deposit number will show automatically.

Searching for the Associated Deposit Using a Transaction Search

Here’s an example of how to search for the associated deposit using the NetSuite GUI. Note that the “Applied To Transaction” field requires that you prefix the payment transaction ID with “Payment #” or you won’t be able to find a match in the search creation GUI.

Here’s a direct link to open up a deposit transaction search.

Example Payment Record
Example Deposit Search