sfmc // SSJS / WSProxyPROJECT

WSProxy Retrieve All Pages

Retrieve every page from a WSProxy SOAP object instead of silently stopping at the first batch.

ssjswsproxyretrievepagination
Context Pack →Open Workspace →
Trust & provenancePROJECT
Evidence tierPROJECTOfficial sources2Other sources0Last verified2026-10-05

Evidence tier describes my hands-on relationship with the content. Official sources describe platform contracts/documentation. Production observations should not automatically be treated as official limits.

EvidencePROJECT
Difficultyadvanced
Verified2026-10-05
Use when

Inventorying DEs, automations or other SOAP objects for discovery tooling.

<script runat="server">
Platform.Load("Core","1.1.1");

var prox = new Script.Util.WSProxy();
var objectType = "DataExtension";
var props = ["Name","CustomerKey","ObjectID"];
var result = prox.retrieve(objectType, props);
var rows = [];

while (result) {
  if (result.Results) {
    for (var i = 0; i < result.Results.length; i++) {
      rows.push(result.Results[i]);
    }
  }

  if (!result.HasMoreRows) break;
  result = prox.getNextBatch(objectType, result.RequestID);
}

Write(Stringify({ count: rows.length }));
</script>
Why it works

WSProxy returns HasMoreRows and RequestID; getNextBatch continues the same retrieve until no more pages remain.

Operational notes

Build pagination into a shared helper for auditing/extraction tooling.

Sources / verification