0

I created a SSJS script to delete certain records from a DE which seems to work fine for less than 2500 records. But once the number of records that need to be deleted surpass 2500 records, then it does not seem to work! I am guessing 2500 is the limit of the SSJS function DeleteData. Is there anyway we can overcome this 2500 limit if we need to delete more than 2500 records? My script for your reference is:

<script runat="server">

Platform.Load("core", "1.1.1");
 try {
   var deleteDE = DataExtension.Init("CABB6918-5DC2-4612-AC42-C10896F0F331");
     var data = deleteDE.Rows.Retrieve();

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

       var subKey = data[i].Email;
var perm = data[i].Permission;

var rowDelete2 = Platform.Function.DeleteData('Permissions',['EmailAddress','Permission'],[subKey,perm]); //deletes from Permissions DE
    };



 }
 catch (ex) {
        Write("An error has occurred: " + Stringify(ex));
        Variable.SetValue("@Result", Stringify(ex));  //sets above ampscript variable
    }





</script>

Thanks, Gaurav

6
  • 1
    Do you want to delete all rows or just some of those based on logic/data?
    – jc_mc
    Commented Jul 18, 2019 at 7:24
  • 3
    The total done in a single run is limited to 2500 regardless. There is no way to overcome this. Utilizing for loops to do multiple calls should be able to get beyond the limit (may need to add some 'wait' periods to allow for the first deletes to be processed or the cache to catch up), or using the 'continuerequest' feature inside of API calls may also be an option for you. Commented Jul 18, 2019 at 13:01
  • @Gortonington, do you have any example of how I can implement multiple calls using loops and wait periods? Or any example of incorporating the continuerequest feature within this SSJS script? Thanks for your help.
    – gds945
    Commented Jul 18, 2019 at 23:05
  • continuerequest is only available in API. You would need to change your process to an API instead of the built in SSJS function to utilize. The for loop would be the same as any for loop, nothing really unique in how its formed Commented Jul 19, 2019 at 13:21
  • 1
    How do you know the limit is 2500? there is no mention of it. i could remove 200K at once.. but when tried to remove 2M it did remove it but.. somehow it reverted the commit and all records went back to original state Commented Dec 20, 2021 at 7:32

1 Answer 1

-1

You could overcome this limitation by changing the logic from deleting select records in that data extension to deleting all records from a particular data extension.

For this you would need to use a different endpoint: POST /contacts/v1/contacts/actions/delete?type=listReference

1
  • Thanks for your reply but I am looking to delete only selected records in my use case.
    – gds945
    Commented Jul 18, 2019 at 23:03

You must log in to answer this question.

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