【问题标题】:How to navigate to Communities's Menu Item with LWC如何使用 LWC 导航到社区的菜单项
【发布时间】:2019-06-11 09:30:35
【问题描述】:

我正在使用不同的导航菜单项设置一个新的 Salesforce 社区,并且我想制作一个带有指向此自定义菜单项之一的链接的 LWC

我正在使用 Salesforce 提供的 Javascript 导航工具。我使用页面类型 standard__namedPage 作为 LWC 文档中的说明,并用我的自定义导航项的名称填充属性 pageName。

        this[NavigationMixin.Navigate]({
            type: "standard__namedPage",
            attributes: {
                pageName: "my-custom-nav-item-name"
            }
        });

结果只是一个“无效页面”,我不知道为什么。

【问题讨论】:

  • 你解决过这个问题吗?我有一个类似的问题。此外,它是 comm__namedPage 现在不是标准的__namedPage
  • 不幸的是,我还没有找到任何解决方案。 @小鹿
  • 我能够找出下面的解决方案。

标签: salesforce salesforce-lightning


【解决方案1】:

您似乎需要确保社区中的页面引用与正确的页面类型匹配。我认为 SF 文档有点混乱。

这个解决方案让我可以导航到我的 LWC 社区页面中的自定义记录列表页面:

    this[NavigationMixin.Navigate]({
      type: 'standard__objectPage',
      attributes: {
          objectApiName: 'PMP_Offering__c',
          actionName: 'home'
      },
      state: {
          filterName: 'Default'
      }
  });

此外,这些解决方案也很有效:

//Page Reference -- Community Page
                type: 'comm__namedPage',
                attributes: {
                    pageName: this.communityPage
                }
// Page Reference -- Record Page
                type: "standard__recordPage",
                attributes: {
                    recordId: this.recordId,
                    objectApiName: this.objectPage,
                    actionName: "view"
                }
// Page Reference -- Object Page
                type: "standard__objectPage",
                attributes: {
                    objectApiName: this.objectPage,
                    actionName: "list"
                },
                state: {
                    filterName: "Recent"
                }

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-02-18
    • 1970-01-01
    • 1970-01-01
    • 2016-06-17
    • 2013-06-13
    • 1970-01-01
    相关资源
    最近更新 更多