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
- Common SuiteScript Errors and Solutions for NetSuite
Common NetSuite script errors include INVALID_SCRIPT_DEPLOYMENT_ID and SSS_AUTHORIZATION_HEADER_NOT_ALLOWED. Learn effective solutions.
- Set Sublist Field Values in SuiteScript 2.x for Record Management
Set sublist field values in SuiteScript 2.x for effective record management using standard and dynamic modes.
- Setting Field Values in SuiteScript for Effective Record
Learn to set field values in SuiteScript effectively, troubleshooting common errors and understanding data types.
- SuiteScript 2.1 Enhancements and API Updates in NetSuite
SuiteScript 2.1 enables execution of 2.0 scripts and supports PATCH method for enhanced API capabilities.
Advertising
Reach SuiteScript Professionals
Put your product in front of NetSuite experts who work with SuiteScript every day.
Sponsor This Category