2

I've created a custom form in LWC where I added 2 buttons & this LWC is on Record page on as a Quick Action button(LWC is called from Lightning Flow), Save and Cancel. Both are custom button and navigates back to the Record Detail Page. For this below is the code that I have added to navigate to the Record Detail Page:

this[NavigationMixin.Navigate]({
                    type: 'standard__recordPage',
                    attributes: {
                        recordId: this.recordId,
                        objectApiName: 'Case',
                        actionName: 'view'
                    }
                });

I have tested this on the app whose navigation style is Standard. navigation works there as expected but when I launch Application(Service) whose navigation style is Console, then above code does not work.

Can someone please tell me what changes are required?

4
  • I am not sure if this is the cause, try appending , focus: true after the attributes.
    – Naga
    Commented Feb 17, 2021 at 22:28
  • You need to wrap the component in an Aura, LWC does not currently support Salesforce Console APIs check documentation here : developer.salesforce.com/docs/component-library/documentation/…
    – Shamina
    Commented Feb 18, 2021 at 5:55
  • @Naga Tried to add focus:true but its not working.
    – SFDCDJ
    Commented Feb 18, 2021 at 7:30
  • @Shamina So instead of navigating to Record View, I tried to navigate to Object's list view or Object home and its working. So as per documentation if its not supported then this should not even work for List View or object home Navigation.
    – SFDCDJ
    Commented Feb 18, 2021 at 7:32

1 Answer 1

5

As per below Salesforce Documentation, When we navigate to Record View Page, We can keep objectApiName as an optional parameter.

https://developer.salesforce.com/docs/component-library/documentation/en/lwc/lwc.use_navigate_page_types

So after removing objectApiName in my code, its working somehow. Not sure if its best practice for Console Navigation. but its working.

this[NavigationMixin.Navigate]({
                    type: 'standard__recordPage',
                    attributes: {
                        recordId: this.recordId,
                        //objectApiName: 'Case', // objectApiName is optional
                        actionName: 'view'
                    }
                });
1
  • 2
    Not sure why this had 0 votes when I can across it, but removing the objectApiName was exactly the fix I needed. Removing that and navigation works in the current open tab in the service console.
    – TehNrd
    Commented Oct 12, 2022 at 4:52

You must log in to answer this question.

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