Does anyone know how to Update ActiveFlag Using WS Proxy?
<script runat="server">
Platform.Load("Core", "1.1.1");
try {
var prox = new Script.Util.WSProxy();
var cols = ["ID", "Name", "ActiveFlag"];
// Replace with the name and key of your data extension
var deName = "For_Deactivation_User_DE";
var deKey = "";
var de = DataExtension.Init(deKey);
// Retrieve all the rows from the data extension
var data = de.Rows.Retrieve();
for (var i = 0; i < data.length; i++) {
var email = data[i].EmailAddress;
// Filter the AccountUser records based on the UserId field
var filter = {
Property: "Email",
SimpleOperator: "equals",
Value: email
};
var accountUsers = prox.retrieve("AccountUser", cols, filter);
for (var j = 0; j < accountUsers.Results.length; j++) {
var accountUser = accountUsers.Results[j];
accountUser.ActiveFlag = false;
// Update the AccountUser record
var updateResponse = prox.updateItem("AccountUser", accountUser);
Write("Account User " + accountUser.Email + " ActiveFlag property was updated to false.");
}
}
} catch (ex) {
Write("An error has occurred: " + Stringify(ex));
}
I used this code but I receive this below error.
An error has occurred: {"message":"Error executing update call.","description":"ExactTarget.OMM.FunctionExecutionException: Error executing update call.\r\n Error Code: OMM_FUNC_CONTEXT_ERR\r\n from Jint --> \r\n\r\n --- inner exception 1---\r\n\r\nExactTarget.OMM.InvalidFunctionParameterException: Property: UserPermissions is an array but value to be set was not an array.\r\n Error Code: OMM_FUNC_CONTEXT_ERR\r\n - from OMMCommon\r\n\r\n\r\n\r\n"}
Please help.