Example code not working

This same code from the docs:

New-UDDashboard -Title 'PowerShell Universal' -Content {
    
} -Navigation {
    New-UDList -Children {
        New-UDListItem -Label "Home"
        New-UDListItem -Label "Getting Started" -Children {
            New-UDListItem -Label "Installation" -OnClick {}
            New-UDListItem -Label "Usage" -OnClick {}
            New-UDListItem -Label "FAQs" -OnClick {}
            New-UDListItem -Label "System Requirements" -OnClick {}
            New-UDListItem -Label "Purchasing" -OnClick {}
        }
    }
} -NavigationLayout permanent

does not seem to work. I’ve tested 2.7.4 - 2.8.3 with this code and other variations of -Navigation and consistently get the below (or a variation of it).

Mar 5, 2022 9:09 AM Startup: Cannot process argument transformation on parameter 'Navigation'. Cannot convert the "
    New-UDList -Children {
        New-UDListItem -Label "Home"
        New-UDListItem -Label "Getting Started" -Children {
            New-UDListItem -Label "Installation" -OnClick {}
            New-UDListItem -Label "Usage" -OnClick {}
            New-UDListItem -Label "FAQs" -OnClick {}
            New-UDListItem -Label "System Requirements" -OnClick {}
            New-UDListItem -Label "Purchasing" -OnClick {}
        }
    }
" value of type "System.Management.Automation.ScriptBlock" to type "System.Collections.Hashtable[]". 

Hi @jello, thanks a lot for posting about this. You are absolutely correct.

I am guessing that the documentation just needs an update so I went and ahead and posted request #39 on the documentation github here. Below is my suggested workaround code to hold us over in the meantime. Please let us know if this helps.

New-UDDashboard -Content {
} -Navigation (
    New-UDList -Children {
    New-UDListItem -Label "Home"
    New-UDListItem -Label "Getting Started" -Children {
        New-UDListItem -Label "Installation" -OnClick {}
        New-UDListItem -Label "Usage" -OnClick {}
        New-UDListItem -Label "FAQs" -OnClick {}
        New-UDListItem -Label "System Requirements" -OnClick {}
        New-UDListItem -Label "Purchasing" -OnClick {}
    }
})  -NavigationLayout permanent

Documentation has been updated. Thanks!

1 Like