It seems that calling fieldstorage.UpdateRecordField(field) is attempting to perform an INSERT as we are getting the following error when trying to call this function since upgrading to 4.3.3 from 4.1:
Update field: System.Data.SqlClient.SqlException (0x80131904): Violation of PRIMARY KEY constraint 'PK_UFRecordFields'. Cannot insert duplicate key in object 'dbo.UFRecordFields'. The duplicate key value is (1fde6639-bbf2-4b63-a8b9-a120f5ce8cf2).
The statement has been terminated.
Umbraco.Forms.Data.Storage.RecordStorage storage = new Umbraco.Forms.Data.Storage.RecordStorage();
Umbraco.Forms.Core.Record record = storage.GetRecordByUniqueId(new Guid(myrecordID));
if (record != null)
{
Umbraco.Forms.Data.Storage.FormStorage formStorage = new Umbraco.Forms.Data.Storage.FormStorage();
Umbraco.Forms.Core.Form form = formStorage.GetForm(record.Form);
record.GetRecordField("Field To Update").Values.Clear();
record.GetRecordField("Field To Update").Values = new List<object> { newValue};
RecordService.Instance.Submit(record, form);
}
I believe we had something back to front in the insert macro and not specifying the variables correctly in the end. Sorry but I can't remember specifically.
UpdateRecordField is not updating
It seems that calling fieldstorage.UpdateRecordField(field) is attempting to perform an INSERT as we are getting the following error when trying to call this function since upgrading to 4.3.3 from 4.1:
Update field: System.Data.SqlClient.SqlException (0x80131904): Violation of PRIMARY KEY constraint 'PK_UFRecordFields'. Cannot insert duplicate key in object 'dbo.UFRecordFields'. The duplicate key value is (1fde6639-bbf2-4b63-a8b9-a120f5ce8cf2). The statement has been terminated.
Is this intended or is it a bug?
Many thanks, Warren
I'm having the same issue. Where you able to resolve this one?
I updated my field using this:
I believe we had something back to front in the insert macro and not specifying the variables correctly in the end. Sorry but I can't remember specifically.
is working on a reply...