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 Platform
- Style Object Members for Workbook API in NetSuite
The Style object provides customizable properties for workbook formatting in NetSuite, enhancing report and visualization functionality.
- Asynchronous HTTP Requests with SuiteScript Promises
Use SuiteScript to send asynchronous HTTP requests with promises for efficient error handling and response processing.
- Setting Sublist Field Values in SuiteScript
Set values for sublist fields in SuiteScript using the setSublistValue method. Understand required parameters and error handling.
- In This Help Topic
Explore N/log module guidelines, log levels, and script execution logs for efficient logging in SuiteScript.
Advertising
Reach Platform Professionals
Put your product in front of NetSuite experts who work with Platform every day.
Sponsor This Category