1

I`m going to delete mulitiple data extension records with Server-Side Javascript, so I used function of 'Platform.Function.DeleteData' and code as following:

Platform.Function.DeleteData("Map Tags With Emails", ["Email ID"], arrayEmailIds);

Here 'arrayEmailIds' is a variable of array type, but it is not to works. Then I change the code as following:

var emailIds = Request.GetFormField("emailIds");
var arrayEmailIds = Platform.Function.ParseJSON(emailIds);
for (var i = 0; i < arrayEmailIds.length; i++) {
    Platform.Function.DeleteData("Map Tags With Emails", ["Email ID"], [arrayEmailIds[i]]);
}

It works properly, even so I think it is not a good way to do this, so I want to get a better method to involve this case.

1 Answer 1

1

Your process uses the API in order to delete the rows. There is also a SSJS function for deleting data extension rows. To be honest, I'm not sure which approach is best.

For more information on the SSJS function, refer to the Remove(filtercolumns,filtervalues) function on the following page.

https://developer.salesforce.com/docs/atlas.en-us.mc-programmatic-content.meta/mc-programmatic-content/ssjs_dataExtensionRowsRemove.htm

6
  • Hi David, I tried it but it didn`t work. I changed the code as following: var mapDE = DataExtension.init("MapTagsWithEmails"); mapDE.Rows.Remove(["Email ID"], [arrayEmailIds]);
    – Leisure
    Aug 25, 2015 at 8:46
  • I think you need to adjust the syntax slightly. Each parameter in the remove function needs to be in name value pairs. Will something like this work for you? ------ var mapDE = DataExtension.init("MapTagsWithEmails"); mapDE.Rows.Remove(["Email ID", "value"]); Aug 26, 2015 at 13:23
  • Sorry, there was a typo about the 'init', it should to be 'Init'.
    – Leisure
    Aug 27, 2015 at 2:58
  • And I don`t think your codes is right, because the syntax was wrong, I tried.
    – Leisure
    Aug 27, 2015 at 4:16
  • the link looks broken. Kindly update the link please
    – sfdcFanBoy
    Apr 2, 2018 at 2:48

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .