Kostenlose Erstberatung
Montag, 12 August 2019 14:37

Access more than 10.000 records in a sublist

Written by

Filtering invoices on Customer Payments in SuiteScript

This article will help you in the following scenario: You have a customer with a very high number of invoices open and there is a need to create a payment with some of them applied to. E.g. in an EDI environment.


When you try to do it in the NetSuite UI

you will see that on the apply sublist only 10.000 records are displayed and this is not a coincidence. NetSuite is limiting sublist to have only first 10.000 records displayed even if you have more transactions in it.
You can try to solve the problem by using date filters or change the sorting order - it is not a very handy solution, but still you can find the ones you need.


But what if you need to create a payment in a script?

Normally to create a payment for a customer you will use:
var payment = nlapiTransformRecord('customer', customerId, 'customerpayment');
var id = nlapiSubmitRecord(payment);
Unfortunately it won't allow you to filter data in the sublist, so if you try to apply transactions which are not in the first 10.000 lines script will not find them.
The solution for it is partially described in NetSuite help - unfortunately it is only available for nlapiCreateRecord() ( not for nlapiTransformReord() ) which takes initializeValues as a second parameter and for Customer Payment we have the following options:
Which means that our code should look like this:
var payment = nlapiCreateRecord('customerpayment', {
                entity: customerId,
                invoices: invoices,
var id = nlapiSubmitRecord(payment);
... where invoices is a comma seperated list of internal ids of transaction which we want to have displayed on the apply sublist.
What if we also want to manipulate the sublists credits and deposits? Well, officially there is no way, but unofficially there are two more initialise values we could use 'credits' and 'deposits'
var payment = nlapiCreateRecord('customerpayment', {
                entity: customerId,
                credits: credits,
                deposits: deposits,
                invoices: invoices,
They work in the same way - string with comma separated list of internal ids of transaction.
Thanks to them you will be able to bypass the 10.000 records limit on a sublists and book your payments automatically.
Read 1743 times Last modified on Freitag, 16 August 2019 14:42

Latest from Lukasz Kubasiewicz

Leave a comment

Make sure you enter all the required information, indicated by an asterisk (*). HTML code is not allowed.


O NetSuite SuiteCloudDeveloperNetwork rgb 2NetSuite SolutionProvider horiz rgb

Hinweis zum Datenschutz

Wir sind bemüht, Ihnen den bestmöglichen Service auf dieser Seite zu bieten. Damit dies reibungslos funktioniert verwenden wir sog. Cookies. Unsere Datenschutzbestimmungen können Sie unter dem Menu Datenschutz nachlesen.

Ich habe verstanden.