1

We have a lot of @Customer.com Emails in our Auto Suppresion lists but I want to remove them all from the Auto Supression.

Bellow is to delete multiple records in the Auto Suppresion list but we have to insert the Email addresses is there a way where we can say delete all with @customer for example?

<script runat="server">

Platform.Load("Core","1.1.1");

     var deleteEmails = DataExtension.Init("toDelete");
     var data = deleteEmails.Rows.Retrieve();

     for (var i=0; i < data.length; i++) {

       var email = data[i].Email;

       var deleteRow = Platform.Function.DeleteData('AutoSuppressionExternalKey',['Email Address'],[email]);

    };

</script>
0

1 Answer 1

3

The trick is to create a field that they all have in common in the autosuppression list and delete based on that.

In your autosuppression, create a field "ToBeDeleted"

Create an SQL query where you can write a "LIKE" statement.

SELECT
[email address] as email m

FROM 
myAutosuppression m
WHERE
m. [email address] LIKE '%@customer%'
/* into anotherDE */

Now you have a DE with all relevant records. Then, get them back into your autosuppression with a "toBeDeleted" marker.

SELECT
a.[email address] as email
,'true' as toBeDeleted
FROM 
anotherDE a
/* update myAutosuppression  */

edit:

for this to work, you have to create this query activity via the API, else you cannot target the autosuppression (UI limitation). Of course, you can also do this via import, but it's somewhat clumsy.

End edit

Then run your script without any loops:

<script runat="server">
var deleteRow = Platform.Function.DeleteData('AutoSuppressionExternalKey',['toBeDeleted'],['true']);
};
</script>

The good thing is, you will not have limits imposed by the lookup / for looping through JS, meaning it scales better. And it is quite fast, too.

As a performance indicator (mileage will vary): I deleted 20000 marked records in 16s script runtime.

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