Copied to clipboard

Flag this post as spam?

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


  • Fredrik Esseen 582 posts 786 karma points
    Feb 19, 2018 @ 15:13
    Fredrik Esseen
    0

    Object reference not set to an instance.. when trying to delete form

    We have a problem when trying to delete a form. We get the following:

    {"Message":"An error has occurred.","ExceptionMessage":"Object reference not set to an instance of an object.","ExceptionType":"System.NullReferenceException","StackTrace":" at Umbraco.Forms.Data.Storage.RecordStorage.DeleteRecord(Record record, Form form)\r\n at Umbraco.Forms.Data.Storage.RecordStorage.DeleteFormRecords(Form form)\r\n ......

    We are using Umbraco Forms 4.40.

    Could it be a matching problem with forms GUID?

  • Lars Nederberg 29 posts 83 karma points
    Feb 27, 2018 @ 09:43
    Lars Nederberg
    0

    I get the same error. Did you solve this?

  • Fredrik Esseen 582 posts 786 karma points
    Feb 27, 2018 @ 13:59
    Fredrik Esseen
    0

    No, not yet. Didnt had the time to look into it but if I find a solution I will share it with you!

  • Matthew Hair 3 posts 23 karma points
    Mar 13, 2018 @ 03:40
    Matthew Hair
    0

    I'm seeing the same error with a custom WorkflowType and UmbracoForms 7.0. If the record.State is set to FormState.Deleted, the error occurs. Here's my Execute method:

            public override WorkflowExecutionStatus Execute(Record record, RecordEventArgs e)
        {
            var distinctFields = DistinctFields.Split(',').Select(x => x.Trim());
            if (IsDuplicate(record, e.Form, distinctFields))
            {
                record.State = FormState.Deleted;
                return WorkflowExecutionStatus.Cancelled;
            }
            return WorkflowExecutionStatus.Completed;
        }
    
  • Matthew Hair 3 posts 23 karma points
    Mar 13, 2018 @ 14:09
    Matthew Hair
    0

    I found a workaround for not being able to set record.State to FormState.Deleted. I set the StoreRecordsLocally property on the Form to false instead, like this:

        public override WorkflowExecutionStatus Execute(Record record, RecordEventArgs e)
        {
            var distinctFields = DistinctFields.Split(',').Select(x => x.Trim());
            if (IsDuplicate(record, e.Form, distinctFields))
            {
                e.Form.StoreRecordsLocally = false;
                return WorkflowExecutionStatus.Cancelled;
            }
            return WorkflowExecutionStatus.Completed;
        }
    
  • Fredrik Esseen 582 posts 786 karma points
    May 22, 2018 @ 12:22
    Fredrik Esseen
    0

    What happens if I only delete the json file in the Data section on the server?

    Will it mess up something on the server or is it that i will have some records and records fields that is just hanging around with no form?

  • Matthew Hair 3 posts 23 karma points
    May 22, 2018 @ 13:11
    Matthew Hair
    0

    If you delete the json file, there will be no BackOffice UI through which you can easily browse your form entries, but they will still be stored in the database tables.

Please Sign in or register to post replies

Write your reply to:

Draft