0
<script runat="server" language="javascript">
  Platform.Load("Core","1.1.1");
  //retrieve all lists
  var lists = List.Retrieve();

  for(var i=0; i<lists.length; i++){
    Write(lists[i].ListName);
    var myList = List.Init(lists[i].ID);
    var subs = myList.Subscribers.Retrieve();
 var count =subs.length;
    Write(count);
    Write("<br>");
  }
</script>

Returns

All Subscribers0
TestPub0
TestTestPub0

This is currently querying every list in our BU, including all subs. It returns zero results for ever publication list we have, all of which have subscribers on them. Any ideas what could be causing this?

2

@Matt Goldstein Based on list Customer key you can retrieve dont use listid try like this

  <script runat="server" language="javascript">
  Platform.Load("Core","1.1.1");
   //retrieve all lists
   var lists = List.Retrieve();


  for(var i=0; i<lists.length; i++){
    Write(lists[i].ListName);
  var liid=lists[i].CustomerKey;
   var myList = List.Init(liid);
  var subs = myList.Subscribers.Retrieve();
   var count =subs.length;
   Write('the countis: '+count);

    Write("<br>");


   }
    </script>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.