I am using the IRecordReaderService and GetRecordsFromForm(), however, whenever it gets called, it returns a null reference error, I am 100% passing in the correct form Id, it was working a month ago when I wrote the functionality, I'm using Umbraco 8.14 and Umbraco Forms 8.7.1.
Any help would be appreciated :)
My code is as below:
var guid = Guid.Parse(model.FormId);
PagedResult<IRecord> AllRecords = _recordReaderService.GetRecordsFromForm(guid, 1, 10);
the error I'm getting is below
[NullReferenceException: Object reference not set to an instance of an object.]
Did you ever get to the bottom of this?
Taking a guess, has the form been modified, either a field removed, or a new one added? If so that could be causing your issue.
I didn't, I have time booked in this week to investigate it further and maybe find another way of doing it, but it happens with any form, new or old, it's really strange
IRecordReaderService causing null reference exception
Hey everyone
I am using the IRecordReaderService and GetRecordsFromForm(), however, whenever it gets called, it returns a null reference error, I am 100% passing in the correct form Id, it was working a month ago when I wrote the functionality, I'm using Umbraco 8.14 and Umbraco Forms 8.7.1.
Any help would be appreciated :)
My code is as below:
the error I'm getting is below
Umbraco.Forms.Core.Services.RecordReaderService.GetRecordsFromForm(Guid formId, Int32 pageNumber, Int32 pageSize) +87 Demelza.Controllers.Authorized.FormsExportController.ExportSingleFormAsPdf(FormExportModel model) in C:\Repos\Demelza\Demelza\Demelza\Controllers\Authorized\FormsExportController.cs:42 lambdamethod(Closure , ControllerBase , Object[] ) +138 System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary
2 parameters) +34 System.Web.Mvc.Async.<>c.<BeginInvokeSynchronousActionMethod>b__9_0(IAsyncResult asyncResult, ActionInvocation innerInvokeState) +38 System.Web.Mvc.Async.WrappedAsyncResult
2.CallEndDelegate(IAsyncResult asyncResult) +76 System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethod(IAsyncResult asyncResult) +41 System.Web.Mvc.Async.<>cDisplayClass110.Hi Liam,
Did you ever get to the bottom of this? Taking a guess, has the form been modified, either a field removed, or a new one added? If so that could be causing your issue.
Nik
I didn't, I have time booked in this week to investigate it further and maybe find another way of doing it, but it happens with any form, new or old, it's really strange
have you injected IRecordReaderService into your constructor?
is working on a reply...