I've found that Salesforce Marketing Cloud's Email Studio UI does not allow for changing the row retention period of data extensions. Once set to 60 days, 60 days it remains. Thankfully the SFMC SOAP API can be used to alter the time period, however with one caveat: it cannot be used to introduce a row-based retention period if the data extension was not originally created with one. Unless you truly need to keep every record forever, it's useful then to always create row retention periods with new data extensions to allow them to be adjusted later. Retention periods of days, months, and years are supported.
Using SFMC's Postman Collection, I use the following SOAP call to update the row retention period for a data extension:
<?xml version="1.0" encoding="UTF-8"?> <s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:a="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:u="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"> <s:Header> <a:Action s:mustUnderstand="1">Update</a:Action> <a:To s:mustUnderstand="1">https://{{et_subdomain}}.soap.marketingcloudapis.com/Service.asmx</a:To> <fueloauth xmlns="http://exacttarget.com">{{dne_etAccessToken}}</fueloauth> </s:Header> <s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <UpdateRequest xmlns="http://exacttarget.com/wsdl/partnerAPI"> <Options /> <Objects xsi:type="ns1:DataExtension" xmlns:ns1="http://exacttarget.com/wsdl/partnerAPI"> <CustomerKey>...external key of data extension...</CustomerKey> <ns1:DataRetentionPeriodLength>30</ns1:DataRetentionPeriodLength> <ns1:DataRetentionPeriod>Days</ns1:DataRetentionPeriod> <ns1:ResetRetentionPeriodOnImport>true</ns1:ResetRetentionPeriodOnImport> <ns1:DeleteAtEndOfRetentionPeriod>true</ns1:DeleteAtEndOfRetentionPeriod> </Objects> </UpdateRequest> </s:Body> </s:Envelope>
Of course, adjust length and period as desired. The Customer Key for a data extension can be found in Email Studio, where it is called the External Key:
If the retention period was lowered, you may need to wait up to 24 hours before you see a lower rowcount for the data extension. SFMC apparently does its clearing of old records once per day.
Posted by Glen Mazza in Marketing Cloud at 03:20AM Apr 03, 2023 | Comments[2]