0

I have a Community with 3 home pages created using community builder. My requirement is that depending on a field on the User record, the user who has logged in should be redirected to different home pages.

I am trying to use an apex class to achieve this, as given in the Salesforce documentation

https://help.salesforce.com/articleView?id=networks_configure_custom_home_page_with_oauth.htm&type=5

Code below

 public class CommunitiesLandingController {

// Code we will invoke on page load.
public PageReference forwardToStartPage() {
    System.debug('************');
    String communityUrl = 'https://google.com'; //URL of new page
 return new PageReference(communityUrl);
}

public CommunitiesLandingController() {
}

}

My problem here is that forwardToStartPage method is not being called at all. Even the debug is not printing.

I am logging in to the Community using the Manage External User -> Log in to Community as user button on External User's Contact Record.

2
  • Have you considered using Audience Targeting instead? – David Cheng Apr 10 '20 at 3:47
  • @DavidCheng, audience targeting will not work. I have simplified the requirement here. It's is much more complex. And the complex logic cannot be implemented using audience targeting. – Madhurima Apr 10 '20 at 7:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.