Copied to clipboard

Flag this post as spam?

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


  • Liam Prowse 3 posts 73 karma points
    20 days ago
    Liam Prowse
    0

    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:

    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.]
    

    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, IDictionary2 parameters) +34 System.Web.Mvc.Async.<>c.<BeginInvokeSynchronousActionMethod>b__9_0(IAsyncResult asyncResult, ActionInvocation innerInvokeState) +38 System.Web.Mvc.Async.WrappedAsyncResult2.CallEndDelegate(IAsyncResult asyncResult) +76 System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethod(IAsyncResult asyncResult) +41 System.Web.Mvc.Async.<>cDisplayClass110.

  • Nik 1457 posts 6379 karma points MVP 4x c-trib
    1 week ago
    Nik
    0

    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

  • Liam Prowse 3 posts 73 karma points
    1 week ago
    Liam Prowse
    0

    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

Please Sign in or register to post replies

Write your reply to:

Draft