Skip to content

Instantly share code, notes, and snippets.

@katydorjee
Last active August 25, 2020 03:59
Show Gist options
  • Save katydorjee/069c9dc16e79d5d5dc2d124ecd4eb0a8 to your computer and use it in GitHub Desktop.
Save katydorjee/069c9dc16e79d5d5dc2d124ecd4eb0a8 to your computer and use it in GitHub Desktop.
Delete records from a Data Extension using SSJS
<script runat="server">
Platform.Load("core","1");
try {
var DE_name = 'DataExtension Name';
var Lookup_value = 'lookup value';
var dataRows = Platform.Function.LookupRows(DE_name,'Lookup_Fieldname',Lookup_value);
if(dataRows && dataRows.length > 0) {
var rows = Platform.Function.DeleteData(DE_name,'Lookup_Fieldname',Lookup_value);
Write(Stringify('Rows deleted: '+rows));
}else
{
Write('There is no record to delete');
}
}
catch(err) {
Write(Stringify(err));
}
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment