I have created custom tabs inside an object's flexipage and I wonder if there's a way to redirect via js or apex to this custom tab. For example I want to be redirected to 'Oferta' tab after doing some custom development. enter image description here

Thanks in advance

  • Have you taken a look at lightning:navigation, if that solves your use case here? – Jayant Das Dec 18 '18 at 13:39
  • @JayantDas Yes, I already checked that and didn't find anything usefull for my case. – molinet Dec 18 '18 at 13:51

You can use standard__navItemPage (Navigation Item Page Type) with lightning:navigation here. Refer to the documentation for pageReference Types those are utilized with the component for details. From documentation:

Navigation Item Page Type

A page that displays the content mapped to a CustomTab. Visualforce tabs, Web tabs, Lightning Pages, and Lightning Component tabs are supported.

Your navigation should look like as below:

    "type": "standard__navItemPage",
    "attributes": {
        "apiName": "MyCustomTabName" // replace with the API name of your custom tab   
  • Hi Jayant i have used following piece of code i am getting URL doesn't exists error. – Deepak Agarwal Nov 7 '19 at 11:24
  • var pageReference = { "type": "standard__navItemPage", "attributes": { "apiName": "Detail" // replace with the API name of your custom tab } }; component.set("v.pageReference", pageReference); var navService = component.find("navId"); var pageReference = component.get("v.pageReference"); alert(JSON.stringify(pageReference)); event.preventDefault(); navService.navigate(pageReference); – Deepak Agarwal Nov 7 '19 at 11:24
  • this doesn't work for me – Patlatus Mar 15 at 8:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.