Payment with +10k transactions
Hi everyone,
I’m looking for the best practice in SuiteScript 2.1 for a performance issue.
The Challenge: I have a script that needs to apply a payment to a specific invoice for a customer with over 35,000 open invoices.
The Problem: Creating a payment from the customer record using record.create or record.transform fails. Both methods try to load all open invoices into the apply sublist, which hits the ~10,000 record governance limit. This makes it impossible to find and apply the payment to the correct invoice if it’s not in that first batch.
Failed Attempts:
- Loading the Payment: Fails due to the 10k limit.
- Loading the Invoice: Fails due to a timing issue (the invoice doesn’t “see” the newly created payment to apply it).
Question: What is the recommended architecture for this scenario? Is a two-script solution (one to create the payment and a subsequent one to apply it) the only reliable way?
Thanks for your help!
Hi,
If you have the list of invoice IDs, I’m pretty certain you can use the defaultValues parameters in record.create, etc:
defaultValues: {invoices: [956151, 1398892]}
Thanks,
Chris



