Copied to clipboard

Flag this post as spam?

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


  • Julien Kulker 44 posts 267 karma points c-trib
    Jul 02, 2020 @ 06:54
    Julien Kulker
    0

    Umbraco Forms: Resultpage can't find always a result trough recordReaderService

    Hello,

    I have a umbraco forms resultpage. On the resultpage i try to get the tempdata and then find the recourd with the recordReaderservice.

    In most cases it works fine. but in some cases it seems like the recordReaderservice can't find the record.

    resulting in:

    Exception:
    System.InvalidOperationException: Sequence contains no elements
    at System.Linq.Enumerable.First[TSource](IEnumerable`1 source)
    

    The recordreaderservice is not opensource? So i can't check what this code do. Maybe it is using search in the background and the index is not updated on time.

    down the code:

    var recordReaderService = Current.Factory.GetInstance<IRecordReaderService>();
    if (TempData["Forms_Current_Record_id"] != null)
    {
        var currentRecordId = TempData["Forms_Current_Record_id"];
        var listFormIds = (List<Guid>)TempData["UmbracoForms"];
        var currentRecord = recordReaderService.GetRecordsFromForm(listFormIds.First(), 1, 1000).Items.Where(r => r.UniqueId == new Guid(currentRecordId.ToString())).First();
    }
    

    Any help would be really appricated

Please Sign in or register to post replies

Write your reply to:

Draft