I'm having trouble updating a row in data extension. Code I use:

int businessUnitID; //Unit ID
string dataExtensionCustomerKey; //Data Extension Customer Key
DataExtensionObject row; //Data Extension row I want to update, retrieved with previous call and with Properties changed
APIProperty[] PrimaryKeys; //Data Extension Primary Keys

row.Keys = PrimaryKeys;
row.CustomerKey = dataExtensionCustomerKey;

UpdateOptions uo = new UpdateOptions();
SaveOption so = new SaveOption();
so.PropertyName = "*";
so.SaveAction = SaveAction.UpdateOnly;

uo.SaveOptions = new SaveOption[] { so };

ClientID client = new ClientID();
client.ID = businessUnitID;
client.IDSpecified = true;
client.ClientID1 = businessUnitID;
client.ClientID1Specified = true;

uo.Client = client;

UpdateResult[] uResults;
String uStatus;
String uRequestID;

uResults = ETSoapClient.Update(uo, new APIObject[] { row }, out uRequestID, out uStatus);

return uResults;

Error Message I get: Exception occurred during [Update:ProcessUpdateBatch] ErrorID: xxx

  • Where are you setting dataExtensionCustomerKey and PrimaryKeys? Seems like that would be important. – Adam Spriggs Jun 18 '16 at 13:14
  1. DataExtensionObject represents DataExtension Object not a record row. The Keys attribute requires you to pass Key Name and Value for that record
  2. To update an row, you need to use DataExtensionObject.Properties and pass a collection of APIProperty with column Name and Value.

For example you want to update David's firstname and lastname, with "Email" field as unique key:

DataExtensionObject deo = new DataExtensionObject();
deo.CustomerKey = data_extension_customerkey;
deo.Keys = new APIProperty[1];
deo.Keys[0] = new APIProperty();
//Primary Key column
deo.Keys[0].Name = "Email";
deo.Keys[0].Value = "david@example.com";

deo.Properties = new APIProperty[2]; //Two columns to update

deo.Properties[0] = new APIProperty();
deo.Properties[0].Name = "Firstname";
deo.Properties[0].Value = "David";

deo.Properties[1] = new APIProperty();
deo.Properties[1].Name = "Lastname";
deo.Properties[1].Value = "Hughes";

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.