2

We are having trouble adding records to our Auto-Suppression List.

We've used SSJS to first delete and then add records from our master DE to our Auto-Suppression List. Here is our code:

<script runat="server" type="text/javascript">
  Platform.Load("Core","1.1.1");
  try{    

    var  suppList = DataExtension.Init("DE External Key is here.");
    var datas = suppList.Rows.Retrieve();
    for(var i=0; i<datas.length; i++){
      var deleteRow = Platform.Function.DeleteData('TestSuppressionListForEmail',['UniqueId'], [datas[i]["UniqueId"]]);
    }

    var insertList = Platform.Function.LookupRows('DX_UniqueCustomers',['per_email'],[false]);
    if(insertList && insertList.length > 0) {
      for(var i=0; i<insertList.length; i++) {
        var rows = Platform.Function.InsertData("TestSuppressionListForEmail", ["UniqueId", "Email Address", "FirstName", "LastName"], [insertList[i]["Unique_Id"], insertList[i]["email"], insertList[i]["name"], insertList[i]["surname"]]);
      }
    } 

  }catch (e) {
    Write("<b>Error Message:</b> " + Stringify(e.message) + "<br><br><b>Description:</b> " + Stringify(e.description));
  }
</script>

Code works fine for first 2000 records but after that it stops without giving any error. LookupRows function is returning 2000 records. Our master DE contains more than 5 million records and we expect to have more than 1 million records in our Auto-Suppression List. We didn't get any error message. I believe this is happening due to limits. Can someone tell me the mistake we did and how to fix it?

3
  • 1
    You can achieve this without scripting, by creating a DE data extract and overwriting the Auto suppression list daily. Or, if you want to use scripting, it’s better to do this using WSProxy, take a look here for a nice solution example: salesforce.stackexchange.com/questions/289844/… – zuzannamj Jan 29 '20 at 20:38
  • We've tried this method couple days ago but ended up with 25000 records. I don't know the reason. – Baran Sen Jan 30 '20 at 12:50
  • Not sure why, as this is the preferred and most reliable way to do this – zuzannamj Jan 30 '20 at 13:52
1

The rows.retrieve function has a limit of 2500 rows per call. I wouldn’t recommend using SSJS to handle such a large volume of data in that way. You may want to try an Import Activity. Salesforce documentation: https://help.salesforce.com/articleView?id=mc_es_add_subscribers_to_auto_suppression_list.htm&type=5&sfdcIFrameOrigin=null

1
  • Thanks for pointing this method. We were aware of this method but didn't try it before. After your comment, I've created an automation which is working fine. I'm writing the activities so that it may be useful for other MC users: SQL Query(To detect opt outs) > Data Extract > FileTransfer > Import File(to import into our Auto-Suppression List) – Baran Sen Jan 30 '20 at 12:57

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.