New to SSJS but based on what I've read, it looks like this could be possible. I am trying to write a script that will delete a row in a 'Secondary_DE' based on a defined 'Deleted' flag in a 'Primary_DE'.
For example: I want it to look in 'Primary_DE' for records that have a 'True' value in the field called 'Deleted' & then delete those records (based on their 'V_UUID' - present in both DE's) in the 'Secondary_DE'. AFTER it makes that initial deletion from 'Secondary_DE', I'd like it to delete the original record in 'Primary_DE'
I've referenced this question and am unsure what to put in the section starting with "for (var=" of the script (or if this is even the best approach):
<script runat="server">
Platform.Load("Core", "1");
var deleteDE = DataExtension.Init("Secondary_DE EXTERNAL KEY");
var data = deleteDE.Rows.Retrieve();
for (var i=0; i < data.length; i++) {
var subKey = data[i].SubscriberKey;
var rowDelete = Platform.Function.DeleteData('Primary_DE',['Deleted'],[true]);
};
</script>
Any help would be greatly appreciated, thanks!