DeleteData
→ numberRemoves rows from a Data Extension matching the specified filter criteria. Returns the number of rows deleted.
Available in:
Email
CloudPage
Automation
Triggered Send
Syntax
Platform.Function.DeleteData(deName, whereFieldNames, whereFieldValues)
3 arguments
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
deName |
string | Yes | Data Extension name or external key |
whereFieldNames |
string[] | Yes | Array of column names to match for deletion |
whereFieldValues |
array | Yes | Array of values aligned to whereFieldNames that identify rows to delete |
Examples
Basic delete
var deleted = Platform.Function.DeleteData(
"TempSessions",
["SessionToken"], [token]
);
Write("Deleted " + deleted + " session(s).");
Multi-filter delete
// Delete expired AND inactive records
Platform.Function.DeleteData(
"TempData",
["Status", "Active"],
["expired", "0"]
);
Safe delete pattern
// Verify the record exists before deleting
var exists = Platform.Function.Lookup("Orders", "OrderID", "OrderID", orderId);
if (exists) {
var count = Platform.Function.DeleteData("Orders", ["OrderID"], [orderId]);
Write("Deleted " + count + " order(s).");
} else {
Write("Order not found.");
}
Notes
- Returns
0when no rows match (not an error) DeleteDEis an alias with identical behavior — however it is limited to emails.- Irreversible — SFMC DEs have no built-in undo. Always verify the filter before deleting.