CON-1418 - RecordStorage.UpdateRecord - Does not regenerate JSON for RecordData for entries viewer

Created by Warren Buckley 26 Sep 2017, 11:23:26 Updated by Claus Jensen 08 Nov 2017, 09:39:27

This came from a customer support request where they are trying to update a record submitted in a workflow to obfuscate sensitive fields and replace the values stored.

This works fine when the form submission/record is a new record and has not been inserted, the problem comes when the customer tries to update previously submitted records, it would update the database with the correct values in the appropriate database tables with the exception of the UFRecords table with the column RecordData which stores a JSON representation of the fields and their values.

Which is mainly used for displaying the entries in the backoffice - thus it shows the submission not being updated correctly.


Warren Buckley 26 Sep 2017, 12:15:13

This PR fix updates the JSON representation to ensure its in sync before being updated back into the DB record.

PR for 4.4.4 is here - PR for 6.0.4 is here -

Test Notes

Try running this custom workflow on a form before applying the PR & then verify it then works as expected with PR applied

public class ReplaceValuesWorkflow : WorkflowType
    public ReplaceValuesWorkflow()
        Id = new Guid("864ffbe8-b4ab-4a09-8cc5-49084918d63a");
        Name = "Replace all Values";
        Description = "Replaces all open fields beside question id with Anonymized";
    public override WorkflowExecutionStatus Execute(Record record, RecordEventArgs e)
        //Due to data legislation, we have to delete the personal fields from the current form. 
        using (var store = new RecordStorage())

            var records = store.GetAllRecords(e.Form);

            foreach (var rec in records)
                foreach (RecordField rf in rec.RecordFields.Values)
                    if (rf.Alias != "questionid" && rf.Values.Any())
                        rf.Values[0] = "Anonymized";
                store.UpdateRecord(rec, e.Form);

        return WorkflowExecutionStatus.Completed;

    public override List<Exception> ValidateSettings()
        List<Exception> exceptions = new List<Exception>();
        return exceptions;

Claus Jensen 08 Nov 2017, 09:39:25

It works :) Merged in both for v4 and v6

Priority: Normal

Type: Bug

State: Fixed

Assignee: Claus Jensen



Backwards Compatible: False

Fix Submitted:

Affected versions: 4.4.3, 6.0.3

Due in version: 6.0.6, 4.4.6


Story Points:

Cycle: 4