0

while I understand how one could navigate from one Standard Page to another within an LWC component, navigating to Object Page within a Community Site is very troublesome to me. I've seen this example in the eBikes Demo:

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

however, the similar approach doesn't seem to work well in my project.

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

First thing, my Object Page (Case Detail) has a custom base url (/case-list/(recordId)). The Navigation Service instead redirects to /detail/recordId. It results in an error: Invalid Page, which of course makes sense, because such page indeed doesn't exist. So my question is: is there something wrong in my code? Perhaps it should be handled differently?

1
  • Did you try the answer mentioned here? Please mark this as answer if it helped Dec 14, 2023 at 16:20

2 Answers 2

0

Try this ( Resource: https://developer.salesforce.com/docs/component-library/documentation/en/lwc/lwc.use_navigate_page_types )

navigateToWebPage() {
    // Navigate to a URL
    this[NavigationMixin.Navigate]({
        type: 'standard__webPage',
        attributes: {
            url: 'http://salesforce.com'
        }
    },
    true // Replaces the current page in your browser history with the URL
  );
}
0

Could you try to comment the object API Name and try once, this may solve the issue: https://developer.salesforce.com/docs/platform/lwc/guide/use-navigate-page-types.html

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

}

You must log in to answer this question.

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