function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
LinThawLinThaw 

Passing parameter when opening custom Tab

I try to pass parameter when opening custom Tab.
but when passing parameter (c__recordId) in state, name of custom Tab is going show Blank. Why is happen? Is there good way to pass parameter when opening custom Tab.

            var navigation = component.find("navigation");
            var pageReference = {
                type: 'standard__navItemPage',
                attributes: {
                    apiName: 'customTab'
                },
                state: {
                    c__recordId: recordId
                }
            }
            component.set("v.pageReference", pageReference);
            navigation.navigate(pageReference);

Thanks in advance,
Regards,
LinThaw
Danish HodaDanish Hoda
Hi There,
It would be much easier if you navigate using navigateToUrl as below:
        //var recordId=component.get("v.recordId");
        let urlVar = '/lightning/n/<you-Customtab_Name>/?&c__recordIdId='+<recordId>; 
        
        var eUrl= $A.get("e.force:navigateToURL");
        eUrl.setParams({
            "url": urlVar
        });
        eUrl.fire();

 
LinThawLinThaw

Hi Danish,

Thanks, I tried with url too. But same result.
If there is no parameter using navigateToURL or standard__navItemPage, Tab name is show well.
Any suggestion?
User-added image
Regards,
LinThaw

Danish HodaDanish Hoda
Hi there,
Please try using the exact format - </lightning/n/SearchCompanyTab/?&c__recordIdId=<recordId>>
LinThawLinThaw
Hi Danish,
Thanks, I used this format but same result.
({
    doInit : function(component, event, helper) {
        var recordId = component.get("v.recordId");
        let urlVar = '/lightning/n/SearchCompanyTab/?&c__recordId='+recordId;
        var eUrl= $A.get("e.force:navigateToURL");
        eUrl.setParams({
            "url": urlVar
        });
        eUrl.fire();
    }
})

Regards,
LinThaw
Danish HodaDanish Hoda
Hi LinThaw,
I tried replicating your issue in my dev org.
The issue is because the SearchCompanyTab is not added to the Application you are currently working in. 
LinThawLinThaw
Hi Danish,
Thanks, I also added it to Application and it worked. I think there is no other way to do that. Actually I don't want to show this tab as default in application. If there is other way please share me.
Regards,
LinThaw
Danish HodaDanish Hoda
Hi LinThaw,You can mark Default Off the tab in that Application so that it will be available in that Application but not be shown in the tab section.
LinThawLinThaw
Hi Danish,
How can I mark Default Off the tab in the Application?
I tried to hide or default off from Profile, but same result.
Thanks,
LinThaw
Danish HodaDanish Hoda
Hi LinThaw,In the app, you will find a Pen type icon at the right-most panel in the tab-section, named Personlize your nav bar. Click on it --> Add more items --> All --> Select your created Tab. At the rpofile level, make it Default Off so that it doesn't show up in the tab section, but would be available in that app when navigated.  Hope this will help you.
LinThawLinThaw
Hi Danish,
If so that every user must do this personalize settings. If there is no other way for this issue, I will consider to do that.
Thanks for every answer!
Regards,
LinThaw