[SalesForce] Community Lightning page that identifies the running user

I am told that one can detect who the user is in a lightning community and then display a home page based on the current user.

Is this correct?

If this is true, this is what I need to do and I need direction how to do this.

I need to send users a link to the community and after they login, they are taken to a page specifically for the running user.

We are using the napali template. Can anyone explain how one is able to determine the running user without using code but perhaps using a lightning component so we can choose which home page to show them?

Best Answer

I assume that by providing a custom page/experience to the user you are using a lightning component to do so. If that is the case, you are likely to have an underlying apex service that fetches some user-specific data. If you have an apex class you can use the UserInfo.gertUserId() to get the running users Id and from there you can retrieve more information about the user.

If you don't want to use apex, you can use this javascript snippet in your controller to get the user id:

var userId = $A.get("$SObjectType.CurrentUser.Id");
Console.log(userId);

With that id, you can use the lightning data service to retrieve user-specific parameters.

The very last option I can think of is to build page variations for your home page and assign them to different profiles. This will not make it 100% unique for each user but allows you to tailor the experience to user groups.