I'm working on a custom Subscription Management page using CloudPages, and I'm able to update existing subscriptions in the target data extension using SSJS just fine:
var updateResults = Platform.Function.UpdateData(data_extension, ["Market", "Department_Name", "Campaign_Name"], [market, department, campaign_name], ["LastSetBy", "Subscription_Status", "AsOfDate"], ["Custom Unsub", status, Now()]);
But this doesn't work given the nature of these subscriptions (opt-out for our customers) I need to be able to insert new records, and this is the code I'm trying to use:
var upsertResults = Platform.Function.UpsertData(data_extension, 4, "Market", market, "Department_Name", department, "EmailAddress", emailAddress, "Campaign_Name", campaign_name, "ClientID", client_id, "LastSetBy", "Custom Unsub", "Subscription_Status", status, "AsOfDate", Now());
It gives me an error message:
Unable to retrieve security descriptor for this frame.
I also tried a direct InsertData, but this doesn't work:
var insertResults = Platform.Function.InsertData(data_extension, "Market", market, "Department_Name", department, "EmailAddress", emailAddress, "Campaign_Name", campaign_name, "ClientID", client_id, "LastSetBy", "Custom Unsub", "Subscription_Status", status, "AsOfDate", Now());
It gives me the same error message.