Copied to clipboard

Flag this post as spam?

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


  • Mark 122 posts 255 karma points
    Apr 19, 2016 @ 15:42
    Mark
    0

    Umbraco Forms UpdateRecord not updating in back end

    Hi Guys/Gals,

    Hopefully a simple one, I am updating a Record Field in a workflow called on approval using:

    var recordStorage = new RecordStorage();
    recordStorage.UpdateRecord(record, e.Form);
    

    This appears to be working fine, no errors etc. But when I go in to the Umbraco Forms section of the back end and check my records, the values are not shown as changed. If I restart IIS Express (I'm still on my dev pc), the changed values show up, so clearly a caching thing.

    How do I force these changes to show, do I need to update something else too?

    I tried:

    recordStorage.UpdateRecordXml(record, e.Form);
    

    But that throws an error, see here: https://our.umbraco.org/forum/umbraco-pro/contour/64073-Manipulating-values-on-submit#comment-216403

    So appears that the XML table no longer exists and this method is a hangover?

    Any thoughts here?

    Thanks in advance..

    Mark

  • Neil Marshall 10 posts 63 karma points
    May 13, 2016 @ 13:31
    Neil Marshall
    0

    In the UFRecords database table it looks like there is a "RecordData" field and I'm guessing the Umbraco backend uses this for the UI. So after updating the record field value I also updated the RecordData:

    record.RecordData = record.GenerateRecordDataAsJson();
    storage.UpdateRecord(record, e.Form);
    

    It does look like the UpdateRecordXml method is no longer valid.

  • Olie 11 posts 52 karma points
    May 14, 2019 @ 23:53
    Olie
    0

    try delete and insert, seems to do the job.

    public static void UpdateRecord(Record record)
    {
        var form = record.GetForm();
        using (var recordStorage = new RecordStorage())
        {
            recordStorage.DeleteRecord(record, form);
            recordStorage.InsertRecord(record, form);
        }
    }
    
Please Sign in or register to post replies

Write your reply to:

Draft