[SalesForce] Lightning Navigation API – PageReference to Lightning Page Not Working

Any thoughts on why the pageReference here keeps erroring as Page Doesn't Exist? According to docs https://developer.salesforce.com/docs/atlas.en-us.lightning.meta/lightning/components_navigation_page_definitions.htm we are just adding API name. This is a Custom Tab trying to display.

Worked fine if I try to navigate to Account Home as in the example.

({
    init : function(cmp, event, helper) {
        var navService = cmp.find("navService");
        // Sets the route to Lightning Page
        var pageReference = {
            type: 'standard__navItemPage',
            attributes: {
                ApiName: 'Address'
            }
        };
        cmp.set("v.pageReference", pageReference);
        // Set the URL on the link or use the default if there's an error
        var defaultUrl = "#";
        navService.generateUrl(pageReference)
            .then($A.getCallback(function(url) {
                cmp.set("v.url", url ? url : defaultUrl);
            }), $A.getCallback(function(error) {
                cmp.set("v.url", defaultUrl);
            }));
    },
    handleClick: function(cmp, event, helper) {
        var navService = cmp.find("navService");
        // Uses the pageReference definition in the init handler
        var pageReference = cmp.get("v.pageReference");
        event.preventDefault();
        navService.navigate(pageReference);
    }
})

Best Answer

Not sure what finally resolved this to be honest. Java case senstivity was true in the example I posted but I had that correct before and still failed. Might have been caching as I see after making changes to component have to wait a bit for them to propagate.

Related Topic