I have the following SSJS function which uses WSProxy to return an array of all data extensions across all business units, however, when I test the script in a CloudPage (in a child BU), it returns all data extensions ONLY in the Parent BU.

I'm hoping someone can take a look at the prox.retrieve() i put together and let me know why it's only retrieving Data Extensions in the Parent BU and not across all BUs even though I have QueryAllAccounts: true?

function pullAllDataExtensions() {
    var prox                            = new Script.Util.WSProxy();
    var moreData                        = true;
    var reqID                           = null;
    var cols                            = ["Name","CustomerKey","CategoryID","IsSendable", "Client.ID"];
    var filterAllDataExtensions         = {
                                            LeftOperand: {
                                                Property        : "IsSendable",
                                                SimpleOperator  : "equals",
                                                Value           : true
                                            LogicalOperator: "OR",
                                            RightOperand: {
                                                Property        : "IsSendable",
                                                SimpleOperator  : "equals",
                                                Value           : false
    var options                         = {IncludeObjects: true};
    var props                           = { QueryAllAccounts: true };
    var dataExtensionResults            = [];
    while(moreData) {
        moreData = false;
        var data = reqID == null ?
            prox.retrieve("DataExtension", cols, filterAllDataExtensions, options, props) : 
            prox.getNextBatch("DataExtension", reqID);
        if(data != null) {
            moreData    = data.HasMoreRows;
            reqID       = data.RequestID;
            if (data && data.Results) {
                for (i=0; i < data.Results.length; i++) {
    return dataExtensionResults
  • 1
    I have attempted and received same behavior on WSProxy, but it will function correctly via SOAP API. Perhaps this is a limitation of WSProxy that is just undocumented? Jul 16, 2020 at 16:31
  • 1
    I have received confirmation that queryAllAccounts will only work from a top-down perspective. So to get all accounts, you will need to be at the parent level of your enterprise account. Jul 16, 2020 at 17:11

1 Answer 1


From the documentation here, the QueryAllAccounts is a true/false parameter instead of a JSON:

var queryAllAccounts = true;
prox.retrieve("DataExtension", cols, filter, options, queryAllAccounts );
  • Unfortunately, i've tried that too and the results are the same
    – balwill
    Jul 14, 2020 at 12:34
  • It also shows it as an object in the advanced retrieve section var props = { QueryAllAccounts: true };. Both will work correctly: (developer.salesforce.com/docs/…) Jul 14, 2020 at 14:24

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .