The record detail page aspect of the Napili Community is very confusing. Correct me if I am wrong but it looks like you created a set of record pages for Account
. This gave you Account Detail
, Account List
, and Account Related List
. Placing the Account Detail
page as a top level link requires you to hardcode it to a direct Account Id by replacing :recordId
with an actual live Id such as 001E0000014chufIAA
. I am not sure what the actual use case is for this, but this is the functionality Salesforce built. Instead, you could link to the Account List
page (where the user should only be able to see their personal account) then have them click on their Account name to navigate to their Account Detail.
A better solution that would require a little bit of coding would be to create an intermediate lightning component that will get the current User's Account Id using an Apex controller, then in the callback redirect the user to the account detail page using their Account Id. You would then place this on a new community page and use that page as the target for your navigation link.
Here's to hoping that Salesforce adds a 'My Contact' and 'My Account' concept as standard pages in Napili!
Edit - Account Page Creation
@Eric mentioned that he did not in fact create the pages as I noted above but they already existed in his org. My guess is that this difference between orgs has to do with my org being created quite a long time ago so I did not have the pages out of the box.
Eric Edit
Here are the steps I took based on this answer:
- Apex controller to return user's Contact AccountID
- Lightning Component with an Init event that uses
force:navigateToSObject
based on the Id from #1. This takes you to the appropriate Account Detail Object Page
- In Lightning controller Init comment out the event.fire (needed so we can publish the page)
- Create a "Navigate To Account" page in the community
- Add the component to the page in the community (ensure you did step #3)
- Publish the page to the community
- Uncomment the event.fire from #3
- Edit the navigation menu, add an item that goes to the community page you created
- publish and upon clicking the navigation item you will be taken to the user's account
/account/:recordId
when you click on page properties