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 ......
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;
}
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;
}
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.
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?
I get the same error. Did you solve this?
No, not yet. Didnt had the time to look into it but if I find a solution I will share it with you!
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:
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:
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?
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.
is working on a reply...