I have a script in SSJS that works fine inside a CloudPage (I use it for debug). For some unknown reason the same script doesn't work in Script Activity inside the automaton, without any error and without "failing" the Automation. Simply inside the DE there aren't ROWS (the same rows that I delete populated form the same script with Cloud Page).
The script makes an API call, gets back the response, parses it and saves the result inside a data extension with "upsertData" (I also try with upsertDE).
The question is: Can I add/update/upsert the content of a DE with SSJS using a Script Activity?
(without make a request to a Cloud Page inside the Activity)
I make a test with this simple SSJS code (but it's only to understand, my Script is an other thing), RESULT: no rows added to the DE.
Platform.Load("core","1.1.1");
var myde = new DataExtension.Init("CE235575-F895-4394-BH7A-90CAAE52592A");
myde.Rows.Add({"rows_count":"saved row: 1"});
Above, CE235575-F895-4394-BH7A-90CAAE52592A
is the external key of my DE, I have also try with DE name. Also, rows_count
is a Text
field of the DE (maxLength: 50)
In this test I use myde.Rows.Add
but I try also with the other methods (Platform.Function.
): upsertDE/upsertData
, updateDE/updateData
, addDE/addData
. But remember, the same script WORKS inside a CloudPages.
Is it a problem only on my Instance? (If it is I will open a Case but first I want to understand).
{rows_count:"saved row: 1"}