0

I have a big sendable data extension (hundreds of millions records) in marketing cloud that has multiple primary keys. The DE is live, and new records are being written constantly.

I need to delete some records by referencing a date attribute within the data extension, for the records that are over a certain amount of days will need to get deleted, let's say 30 days for example.

I need to run a deletion script in marketing cloud but the only approach I can think of is to match a certain filter using SSJS in a DE irrespective of the primary key. However, I think this approach has the limitations of 2500 rows and I am not sure if it is possible to customize the code to handle more and how.

I am still developing my SSJS knowledge, I will be very grateful for a low-level solution, but any suggestions of what would be the best approach to handle this will be appreciated. Thanks

3
  • 2
    Did you look at whether data retention policy might be relevant for your use case? Feb 21, 2023 at 22:10
  • +1 what Lukas said, or if it’s just a one-off then see if this helps: salesforce.stackexchange.com/questions/289844/…
    – zuzannamj
    Feb 21, 2023 at 22:11
  • Hi @LukasLunow and zuzannamj, thanks. I have the retention policy applied to the DE, but before it kicks in, I will need to complete a one-off deletion. Unfortunately, the retention policy won't be a solution for the current situation.
    – S.Yumi.W
    Feb 22, 2023 at 9:15

1 Answer 1

0

My suggestion will be to add an additional field (e.g. toBeDeleted - boolean) to the DE, and populate it with a Query Activity, which sets it to true for records matching your deletion criteria.

Then you will be ale to apply the DeleteData SSJS function, where you will target the rows where this field is set to True:

<script runat="server">
     var rows = Platform.Function.DeleteData('YourDataExtension',['toBeDeleted'],['true']);
</script>
1
  • Seems like this our best solution. Thank you very much @lukas, this is very helpful. I will give it a try :)
    – S.Yumi.W
    Feb 27, 2023 at 16:36

You must log in to answer this question.

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