ANS-0708 · SUITESCRIPT DEVELOPMENT
How to Script Consolidated Customer Statement Generation in NetSuite
Leverage SuiteScript to programmatically generate and print consolidated customer statements, including options for date ranges and open transactions.
Short answer
NetSuite allows for the programmatic generation of consolidated customer statements using SuiteScript. While `nlapiPrintRecord` (SuiteScript 1.0) can be used with specific properties like `startdate`, `statementdate`, `openonly`, and `consolstatement`, SuiteScript 2.x's `N/render` module offers a modern approach with `render.statement(options)` and `consolidateStatements`.
Scenario
Organizations often require the ability to generate consolidated customer statements programmatically within NetSuite. This is particularly useful for automating financial processes, ensuring timely delivery of statements, or integrating statement generation into custom workflows. The challenge lies in identifying the correct SuiteScript functions and parameters to achieve this, especially when dealing with consolidated statements.
Solution
While SuiteScript 1.0's nlapiPrintRecord function can be utilized for generating statements, it is important to note that SuiteScript 2.x's N/render module is the current recommended approach. For nlapiPrintRecord, properties such as startdate, statementdate, and openonly are standard. The property for consolidated statements, consolstatement, while not explicitly documented in all SuiteScript 1.0 resources, corresponds to the 'Consolidated Statement' option found in the NetSuite UI and the consolidateStatements option in SuiteScript 2.x's render.statement(options).
To generate a consolidated statement using SuiteScript 1.0, the nlapiPrintRecord function can be used with a set of properties. The following code snippet demonstrates how to define these properties, including the consolstatement property for consolidated statements, and then generate the PDF file:
var properties [];
properties.startdate startDate;
properties.statementdate statementDate;
properties.openonly openOnly;
properties.consolstatement consolidateStatement;
var printedStatementFile nlapiPrintRecord('STATEMENT', customerId,
'PDF', properties);For modern SuiteScript 2.x implementations, the N/render module should be used. The equivalent functionality for generating a statement, including consolidated options, is available through the render.statement(options) method, which accepts parameters such as startDate, statementDate, openTransactionsOnly, and consolidateStatements.
Expert NetSuite Support
Need help with this NetSuite issue?
SuiteScript Development consulting and configuration support
