Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Warren Harding 132 posts 275 karma points
    Nov 18, 2016 @ 03:10
    Warren Harding
    0

    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

  • Romeo Cadaoas 33 posts 110 karma points
    May 14, 2017 @ 09:51
    Romeo Cadaoas
    0

    I'm having the same issue. Where you able to resolve this one?

  • Romeo Cadaoas 33 posts 110 karma points
    May 15, 2017 @ 07:58
    Romeo Cadaoas
    0

    I updated my field using this:

    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);
    }
    
  • Warren Harding 132 posts 275 karma points
    May 16, 2017 @ 01:13
    Warren Harding
    0

    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.

Please Sign in or register to post replies

Write your reply to:

Draft