0

I am trying to delete all the email addresses from auto suppression list that are in there for more than x days.

I have reviewed the response to a similar issue here Remove subscribers from Auto Suppression List but I am receiving an error while initializing the auto suppression list

<script runat="server" type="text/javascript">
Platform.load("Core","1.1.1");
var today = new Date();
var prevDate = new Date();
prevDate.setDate(today.getDate()-1);
  
  try{
      var masterDE = DataExtension.Init("External Key of Auto Suppression list");
     //var masterDE = DataExtension.Init("Name of Auto Suppression list"); //Tried passing the name as well
     do{
     var filter = {Property:"Date Added",SimpleOperator:"lessThanOrEqual",Value:prevDate};
     var data = masterDE.Rows.Retrieve(filter);
     var recordCount = data.length;
       for (var i=0; i < recordCount; i++) {
       var email = data[i].[Email Address];
       var rowDelete = Platform.Function.DeleteData('Name of Auto Suppression list',['Email Address'],[email]);
      }
     }while (recordCount > 0);
    }catch (e) {
    Write("\nError Message: " + Stringify(e.message));
}
</script>

The script works fine When I use any exiting data extension's "External Key" while initializing but throws 500 error when using auto suppression's external key. I am running the script in cloud page.

Since auto suppression list is a Data Extension, we should be able to initialize it.

Can someone please advise.

Your Answer

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

Browse other questions tagged or ask your own question.