3

How do we delete subscribers (emails) from Auto suppression list using SSJS. Also, Auto suppression list maintain at SF end or application level.

7

Delete All Records

The following script uses WSProxy to delete all records from an auto-suppression list.

Replace AutoSuppressionExternalKey with the external key of your Auto Suppression List.

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

var prox = new Script.Util.WSProxy();
var res;
var autoSupListDE = 'AutoSuppressionExternalKey'

function clearAutoSuppressionList(){
    var action = 'ClearData';
    var options = {};
    var props = {
        CustomerKey:autoSupListDE
    };
    var res = prox.performItem("DataExtension",props,action,options);
}

function main(){
  clearAutoSuppressionList();
}

main();
</script>

Delete Single Record

Piyush asked how to delete a specific record from an auto suppression list. As auto-suppression lists are effectively Data Extensions, the following SSJS platform function will remove an individual record (based on their email address) from an auto-suppression list:

<script runat="server">
   var deleteRow = Platform.Function.DeleteData('AutoSuppressionExternalKey',['Email Address'],['sam@sample.com']);
</script>

Delete Multiple Records

Piyush also ask how to iterate through a Data Extension containing email addresses for deletion, then remove them from the auto suppression list.

The following script will achieve this, where toDelete is the External Key of the DE containing Email Addresses to delete (which includes a field named 'Email' with the email addresses for deletion), and AutoSuppressionExternalKey is the external key of the auto suppression list.

<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>
6
  • Thank you very much Eliot. Also, what if I want to delete specific one from list ? Oct 19 '18 at 6:26
  • I have updated my answer to provide this option too. Oct 21 '18 at 20:31
  • Thanks Eliot for your kind response. One last ask. What if we want the script to loop through the DE and remove every email address in the DE from the identified list. Means remove from Auto Suppression DE by comparing any list or DE. Thanks in advance. Oct 23 '18 at 5:11
  • Hi @EliotHarper, I have a doubt when I create auto suppression list will it be only used with trigger send emails or it will be used with all email send by sender profile/send calcification associated with the auto suppression list? Sep 13 '19 at 12:35
  • @RushikeshPandit, it's not limited to Triggered Sends. It's based on the sender profile or classification. Refer to my video explanation. Sep 15 '19 at 6:44
0

Thanks for sharing this info, really useful. Also to mention that in the Delete function, Suppression List Name is required instead AutoSuppressionExternalKey.

Correct: Platform.Function.DeleteData('Suppression List Name',['Email Address'],['xxx@yahoo.com']);

Source: https://help.salesforce.com/articleView?id=000352294&type=1&mode=1

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.