Syntax

.getNextBatch(objectType, requestId)
2 arguments

<WSProxyInstance>.getNextBatch(objectType, requestId) continues a paginated retrieve sequence after HasMoreRows is true.

Parameters

Name Type Required Description
objectType string Yes Same SOAP object type passed to the original retrieve call
requestId string Yes RequestID value from the previous retrieve or getNextBatch response

Return value

Same shape as retrieve: Status, RequestID, Results, and HasMoreRows.

Examples

Loop until all rows are read

var proxy = new Script.Util.WSProxy();
var result = proxy.retrieve("DataExtension", ["Name", "CustomerKey"]);

while (result.Status === "OK") {
    for (var i = 0; i < result.Results.length; i++) {
        Write(result.Results[i].Name + "<br>");
    }
    if (!result.HasMoreRows) {
        break;
    }
    result = proxy.getNextBatch("DataExtension", result.RequestID);
}

Notes

Implement a retrieve / getNextBatch loop (see examples below) or wrap it in your own helper — SFMC does not ship a single built-in retrieveBatch convenience on WSProxy.

See Also