Query.runPaged.promise()

Important:

You must specify a sorting order in the query definition when using this method to avoid duplicate or missing results. The query definition must provide a unique and unambiguous sorting order with a specified precedence.

Method Description

Executes the query asynchronously and returns a set of paged results.

Note:

The parameters and errors thrown for this method are the same as those for Query.runPaged(). For more information about promises, see Promise Object.

Returns

Promise Object

Synchronous Version

Query.runPaged()

Supported Script Types

Client and server scripts

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

Governance

10 units

Module

N/query Module

Parent Object

query.Query

Sibling Object Members

Query Object Members

Since

2018.1

Syntax

Important:

The following code sample shows the syntax for this member. It is not a functional example. For a complete promise script example, see Promise Object.

            // Add additional code
...
    var myTransactionQuery = query.create({
        type: query.Type.TRANSACTION
    });
    var myEntityJoin = myTransactionQuery.autoJoin({
        fieldId: 'entity'
    });
    myTransactionQuery.columns = [
        myEntityJoin.createColumn({
            name: 'subsidiary'
        })
    ];
    myTransactionQuery.sort = [
        myTransactionQuery.createSort({
            column: myTransactionQuery.columns[0],
            ascending: false
        })
    ];
    var results = myTransactionQuery.runPaged({
        pageSize: 10,
        customScriptId: 'myCustomScriptId'
    });
    
    // Use the count property to count the search results easily
    var resultCount = myTransactionQuery.runPaged.promise({
        pageSize: 10
    }).count;
...
// Add additional code 

          

Related Topics

General Notices