Search.runPaged(options)

Note:

The content in this help topic pertains to SuiteScript 2.0.

Method Description

Runs the current search and returns summary information about paginated results.

Calling this method does not give you the result set or save the search.

To retrieve data, use PagedData.fetch(options).

Important:

When you use this method to run a paged search, consider the following:

  • Search result sets are not cached. If records applicable to your search are created, modified, or deleted at the same time you are traversing your result set, your result set may change.

  • This method can return a maximum of 1000 pages of search results.

Returns

search.PagedData

Supported Script Types

Client and server scripts

For more information, see SuiteScript 2.x Script Types.

Governance

5 units

Module

N/search Module

Since

2016.1

Parameters
Note:

The options parameter is a JavaScript object.

Parameter

Type

Required / Optional

Description

options.pageSize

number

optional

Maximum number of entries per page

There is an upper limit, a lower limit, and a default setting:

  • The maximum number allowed is 1000.

  • The minimum number allowed is 5.

  • By default, the page size is set to 50 entries per page.

Errors

Error Code

Thrown If

SSS_INVALID_SRCH_SETTING

An unknown search parameter name is provided.

SSS_INVALID_SRCH_SETTING_VALUE

An unsupported value is set for the provided search parameter name.

Syntax
Important:

The following code sample shows the syntax for this member. It is not a functional example. For a complete script example, see N/search Module Script Samples.

          //Add additional code
...
var mySearch = search.create({
    type: search.Type.CUSTOMER
});

// Run the paged search
var pagedData = mySearch.runPaged({
    pageSize: 50
});
...
// Use the count property to count the
// search results easily
var resultCount = mySearch.runPaged({
    pageSize: 50
}).count;
...
//Add additional code 

        

Related Topics

search.Search
N/search Module
SuiteScript 2.x Modules
SuiteScript 2.x

General Notices