0

I'm trying to write a SSJS script in Automation Studio. I want to retrieve column values from one DE, clear that table, and write that column data to another one. (Among other things.) In a prior step, a CSV is imported to a table (SampleDE1.)

Retrieve data:

var holdingTank = DataExtension.Init("SampleDE1");
var filter = {SortOrder:1};
var data = holdingTank.Rows.Retrieve(filter);

var column1val = data[0].column1;
var column2val = data[0].column2;

Clear table:

holdingTank.Rows.Remove(["column1", column1val]);

This is where I am at so far, but it's not working. No records are being removed, there are no errors, and the automation says it's a success. What's going on? There is no console or any way to debug this that I'm aware of.

I'm referring to this page: Data Extension Server-Side JavaScript Functions

If for some reason these functions aren't supported in automation scripts, this'll be the second major roadblock to my project success placed by SalesForce.

1 Answer 1

1

You might want to check your brackets in your Rows.Remove(). I pulled this from a Script Activity that I'm using to delete rows from a DE:

<script type="text/javascript" runat="server">

Platform.Load("core", "1.1.1");

// other code sets jobID
var jobID = "123";

var sl = DataExtension.Init("SendLog");
var delCount = 0;

try {

    delCount = sl.Rows.Remove(["JobID"], [jobID]);
    Write(delCount);

} catch (e) {

    Write(e);

}

</script>
3
  • Hm. I did essentially exactly what you did, to no effect. Also, does e show up anywhere for you? Error logs would be incredibly helpful.
    – St.G
    Dec 6, 2016 at 18:00
  • SFMC Support has access to the logs, but I've found that more trouble than it's worth. I typically write to a log DE in the catch or display them (in some scenarios) Dec 6, 2016 at 18:05
  • They do seem sensitive about those. :) After getting on the line w/ them, it turned out to be an issue with the DE in question being in Shared Data Extensions. Prefacing the reference with "ENT." made it work.
    – St.G
    Dec 6, 2016 at 18:36

You must log in to answer this question.

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