0

We have a requirement where we have built a lightning app page(flexi page) and it has a LWC card component with a button in it. If the user clicks the button it is suppose to open a lightning record page. The requirement is to open the record page in the same tab as of the app page or we can choose home page. We are not able to open the record page in the same tab rather it opens up in a new tab in salesforce nav bar and this new tab can be closed as it has a x icon with it.

This is the code we are using for navigation in LWC

navigateToRecordPage() {
      this[NavigationMixin.Navigate]({
          type: 'standard__recordPage',
          attributes: {
              recordId: 'a1S01000001ZrsTRAS', 
              objectApiName: 'xyz__MyCustomObject__c', // replace with object api name
              actionName: 'view'
          }
      });
  }

Please let us know if it is possible to achieve this?

4
  • 1
    Objects get a nav bar tab of their own, even when the user does not have access to a custom tab for the object. This is what you are seeing. You cannot change this, AFAIK. What you could do is open the object in an overlay created in your component using lightning-record-form (though this does not show the object's flexipage, just uses the page layout for the object to show data).
    – Phil W
    Sep 16 at 8:00
  • Thanks @PhilW for the response. We have been able to do this as you suggested using lightning-record-form but we wanted to just check if it is possible to open in the same tab.
    – TariqueH
    Sep 16 at 19:34
  • As per my first comment, I don't believe there is a way other than what I have suggested.
    – Phil W
    Sep 16 at 20:23
  • Thanks @PhilW :-) Agree. Just wanted to check with forum experts before we make navigation decisions in our new app. Not getting any clarity from SF.
    – TariqueH
    Sep 17 at 20:15

1 Answer 1

0

After some investigation we came across this documentation and it seems upon setting isNavTabPersistenceDisabled flag to true the new tabs will not open. https://developer.salesforce.com/docs/atlas.en-us.api_meta.meta/api_meta/meta_customapplication.htm

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .