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

  • 1
    Do you want to delete all rows or just some of those based on logic/data? – jclobro Jul 18 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. – Gortonington Jul 18 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 Jul 18 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 – Gortonington Jul 19 at 13:21
  • @gortonington, so is there no way that we can do using Ssjs? The loop that you suggested earlier was a part of the API solution as well? Also, do you know if there is a way to delete bulk selected records using ampscript? Ideally my preference is not to use the API. – gds945 Jul 21 at 4:33
-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

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

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.