Page Object Members for Query in SuiteScript
Maximize suite scripting efficiency with Page Object Members, which provide real-time access to paged query results and navigation properties.
The Page Object Members in SuiteScript allow developers to manage query results effectively through a paginated interface. This feature is integral for optimizing data retrieval and rendering in NetSuite solutions.
What Are Page Object Members?
Page Object Members are properties available for a query.Page object, designed to facilitate efficient handling of paged query results. Each member serves a specific purpose, providing access to different aspects of the data contained within the page.
Page Object Members Overview
The following table summarizes the available members for a Page object:
| Member Name | Type | Supported Script Types | Description |
|---|---|---|---|
Page.data | query.ResultSet (read-only) | Client and server scripts | Contains the query results for the current page. |
Page.isFirst | boolean (read-only) | Client and server scripts | Indicates if this is the first page of the paged query results. |
Page.isLast | boolean (read-only) | Client and server scripts | Indicates if this is the last page of the paged query results. |
Page.pagedData | query.PagedData (read-only) | Client and server scripts | Represents the set of paged query results for this page. |
Page.pageRange | query.PageRange (read-only) | Client and server scripts | Details the range of query results for this page. |
How to Use Page Object Members
Using Page Object Members can standardize and streamline data retrieval in SuiteScript.
Example Code Snippet
Here’s a sample syntax demonstrating how to utilize Page Object Members within a SuiteScript context:
1// Example of working with Page Object Members2var myCustomerQuery = query.create({3 type: query.Type.CUSTOMER4});5myCustomerQuery.columns = [6 myCustomerQuery.createColumn({ fieldId: 'entityid' }),7 myCustomerQuery.createColumn({ fieldId: 'firstname' }),8 myCustomerQuery.createColumn({ fieldId: 'email' })9];10var myPagedResults = myCustomerQuery.runPaged({ pageSize: 10 });11 12// Fetching results using an iterator13var iterator = myPagedResults.iterator();14iterator.each(function(resultPage) {15 var currentPage = resultPage.value;16 log.debug(currentPage.pageRange.size);17 return true;18});19 20// Alternatively, using a loop21for (var i = 0; i < myPagedResults.pageRanges.length; i++) {22 var currentPage = myPagedResults.fetch(i);23 log.debug(currentPage.pageRange.size);24}Who This Affects
- Developers: Working with SuiteScript for data retrieval.
- Administrators: Implementing and maintaining data management scripts.
Key Takeaways
- Page Object Members represent a structured way to access paged query results in SuiteScript.
- Each member plays a crucial role in manipulating and retrieving query results efficiently.
- Understanding these members can greatly enhance script performance and data handling capabilities.
Frequently Asked Questions (4)
Which script types support the use of Page Object Members?
How can I determine if a page in a paginated query is the first or last page?
What is the role of the `Page.pagedData` member in paginated queries?
Is it possible to iterate through all pages of a paged query using Page Object Members?
Was this article helpful?
More in SuiteScript
- SuiteScript 2.1 Enhancements in NetSuite February Updates
SuiteScript 2.1 now supports async features and PATCH method. Discover the latest API and SuiteProcurement improvements.
- Scheduling Map/Reduce Script Deployments in NetSuite
Learn to schedule map/reduce script submissions, including one-time and recurring options in NetSuite.
- Binary File Support in N/https Module for SuiteScript
SuiteScript enhances capabilities with binary file support in the N/https module, allowing improved data handling in external communications.
- API Governance Units Calculation in NetSuite 2026.1
NetSuite 2026.1 introduces examples illustrating API governance unit calculations for both user event and scheduled scripts.
