Copied to clipboard

Flag this post as spam?

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


  • Remko 118 posts 283 karma points
    May 05, 2020 @ 12:27
    Remko
    0

    Exception when opening contentEditor from custom dashboard (mntps with xpath startnode inside node)

    Simply said: I made a simple dashboard to show some nodes in a table view. There's a button in each row for editing that node. The button uses the following function to open an editor:

     function showOrderDetails(id, name) {
        var options = {
            id: id
        };
        editorService.contentEditor(options);
    }
    

    This works fine, except for the mntp-properties of the node. Inside these mntps there is a Xpath expression to get startnode:

    $current/ancestor-or-self::shop/descendant-or-self::shopSettings/descendant-or-self::shippingMethods
    

    But this causes an exception (in the background) because $current is not available:

    Possibly unhandled rejection: {"errorMsg":"Failed to retrieve entity data for query $current/ancestor-or-self::shop/descendant-or-self::shopSettings/countries","data":{"Message":"The request is invalid.","MessageDetail":"The parameters dictionary contains a null entry for parameter 'nodeContextId' of non-nullable type 'System.Int32' for method 'Umbraco.Web.Models.ContentEditing.EntityBasic GetByQuery(System.String, Int32, Umbraco.Web.Models.ContentEditing.UmbracoEntityTypes)' in 'Umbraco.Web.Editors.EntityController'. An optional parameter must be a reference type, a nullable type, or be declared as an optional parameter."},"status":400}
    

    The url that is causing the 400 error is:

    /umbraco/backoffice/UmbracoApi/Entity/GetByQuery?query=%24current%2Fancestor-or-self%3A%3Ashop%2Fdescendant-or-self%3A%3AshopSettings%2Fdescendant-or-self%3A%3AshippingMethods&nodeContextId=undefined&type=Document
    

    As you can see nodeContextId=undefined seems to be going wrong here...

    So, when editing the node from the content tree (the regular way) it works fine with mntps with xpath for startnode, but when using editor.contentEditor inside the custom dashboard plugin it doesn't.. Is this a bug? Or does anyone know what I should do to fix this? Any help would be really appreciated.

  • Thomas 315 posts 602 karma points c-trib
    Oct 09, 2020 @ 19:30
    Thomas
    0

    Did you find an solution for this ? :)

  • suman 30 posts 101 karma points
    Nov 10, 2020 @ 11:56
    suman
    0

    Hi Thomas,

    Did you find a solution for this ?

    Thank you

  • Remko 118 posts 283 karma points
    Oct 19, 2020 @ 07:35
    Remko
    0

    No unfortunately I didn't.. Nowadays you won't get much replys over here. So when dealing with these kinds of bugs you have to dive into the core code to find out whats going wrong.

    In this case I didn't have the time to do that. Hopefully you get lucky solving this one ;-)

  • Malka Genzer 12 posts 84 karma points
    Feb 18, 2021 @ 14:45
    Malka Genzer
    0

    I had the same problem on the "content" section, but only in one MNTP (I have several MNTPS that use XPATH), So I rebuild the database cache, and the error is gone. I guess something was missing when it tried to pull the relevant items from the cache. Hope that it'll help...

Please Sign in or register to post replies

Write your reply to:

Draft