1

I have a large number of subscribers I need need to move from an ExactTarget data extension into different lists using ssjs. This is the basic script I am using

<pre>
<script runat="server">
Platform.Load("core","1");

var tempDE = DataExtension.Init("Temp");
var oldList = List.Init(2830)
var newList = List.Init(2833)

var arrayLength = 1;

while (arrayLength > 0) {
var tempDeResults = tempDE.Rows.Retrieve();
var arrayLength = tempDeResults.length;

if (arrayLength > 50) { arrayLenght = 50; }

for (var i = 0; i < arrayLength; i++) {

    var sub = tempDeResults[i]['Email Address'];

    var moveto = newList.Subscribers.Upsert(sub);

var delfrom = oldList.Subscribers.Unsubscribe(sub);

tempDE.Rows.Remove(['Email Address'],[sub]);
}
    location.reload(true);

}
</script></pre>

What I am trying to do is have the script run for 50 subscribers, and then reload for the next 50, as if I have clicked the reload button, but that is not working great, and it get's aborted.

My question what is the best way of say adding 2500 contacts to a list by running s script once? How do I get it to break and restart those requests after 50 subscribers so those calls don't hang? How do I add subscribers asynchronously using ssjs?

Any help here would be great. The more detail the better.

Thanks

3
  • I edited so that all the code is at least visible. I don't have time to fix all the line spacing issues just now.
    – Jagular
    Commented Jun 27, 2014 at 17:33
  • Are you limited to using code? Would you be open to creating an automated solution with AutomationStudio within the application?
    – Timothy
    Commented Jun 30, 2014 at 15:33
  • Yes I would be open to a solution in Automation Studio. So if you can help out that'd be great! Thanks
    – Themba
    Commented Jun 30, 2014 at 22:12

1 Answer 1

1

Its a bit of a hack, but this is how I've done it in the past. You will be relying on your FTP account.

  1. Create a Data Extract activity to get the data out of the DE.
  2. Create a File Transfer activity to get it out of the extract activity directory.
  3. Create another FT activity to get the file into your import directory (so an Import Directory knows where to look)
  4. Create an import activity to get data into the Lists of choice.
  5. Go to Automation Studio, and create an automation to link all these together. Either schedule it, or set up a triggering mechanism to kick it off.

Hope this helps!

You must log in to answer this question.

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