2

Trying to use ssjs 2 functions - Platform.Function.GUID() and Platform.Function.UpsertData in the Script Activity Added Script Activity into the Automation and executed Run Once. No errors, however no data in the fields 'CustomerVehicleId' and 'InternalID' in the DE 'customerVehicle' (DE is in Parent BU) My code:

<script runat="server">
    Platform.Load("Core", "1.1.1");
    try {
        var DE_NAME = "customerVehicle";
        var COLUMN_NAME = "CustomerVehicleId";
        var CustomerVehicleId = Platform.Function.GUID();
        var rows = Platform.Function.UpsertData(DE_NAME, ["InternalID"], [["1"]], [COLUMN_NAME], [CustomerVehicleId]);
        // Log the result of UpsertData
        Write(Stringify(rows));
    } catch (e) {
        // Log any errors
        Write("An error occurred: " + Stringify(e));
    }
</script>

Any ideas why it doesn't fill in the data? Thanks in advance!

0

1 Answer 1

0

You've got an extra set of square brackets around the third UpsertData parameter.

<script runat="server">
    Platform.Load("Core", "1.1.1");
    try {
        var DE_NAME = "customerVehicle";
        var COLUMN_NAME = "CustomerVehicleId";
        var CustomerVehicleId = Platform.Function.GUID();
        var rows = Platform.Function.UpsertData(DE_NAME, ["InternalID"], ["1"], [COLUMN_NAME], [CustomerVehicleId]);
        // Log the result of UpsertData
        Write(Stringify(rows));
    } catch (e) {
        // Log any errors
        Write("An error occurred: " + Stringify(e));
    }
</script>

Results

results

I would also verify the location of the DE -- if in shared and the script is in a child BU, then you need the ent. prefix on the DE Name. Field lengths and data types could also be in play. Since Script Activities have no console or output mechanism, I would test it in a CloudPage so you can see some debugging output.

You must log in to answer this question.

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