Loading

Marketing Cloud Delete Data Extensions in bulk with SSJS

게시 일자: Nov 11, 2025
상세 설명

In the business unit in which you need to delete data extensions make the following DE

Name: DEtoDelete
External Key: DEtoDelete
 

Field NameData TypeLengthPrimary Key NullableDefault Value
DENameText254NoNoNot Applicable
isprocessedBooleanNot ApplicableNoNoFalse



Populate the DE with the DE names which need to be deleted.

Create an SSJS activity with the following code

<script runat="server">
  Platform.Load("core", "1.1.1");
 
  var api = new Script.Util.WSProxy();
  var rowstoprocess = DataExtension.Init("DEtoDelete").Rows.Lookup(["isprocessed"],[0])
    
    for(j=0; j < rowstoprocess.length; j ++ ) 
 {
  var dataExtensionName = rowstoprocess[j].DEName

  var req = api.retrieve("DataExtension", ["CustomerKey"], {
   Property: "Name",
   SimpleOperator: "equals",
   Value: dataExtensionName
  });

  var customerKey = req.Results[0].CustomerKey;

  var res = api.deleteItem("DataExtension", { "CustomerKey":customerKey });

  DataExtension.Init('DEtoDelete').Rows.Update({"isprocessed": "1"}, ["DEName"], [dataExtensionName]);
 }
</script>
솔루션

Run the above SSJS activity to delete any data extensions within the DE "DEtoDelete"

Each occurance of the script will delete only 2000 DE, to delete more, run the activity additional times

If the SSJS errors with a timeout (30mins) run the activity again to delete the remaining DEs

Knowledge 기사 번호

000395614

 
로드 중
Salesforce Help | Article