3

We have built a partner community using the Visualforce & Tabs template. We now want to find out if Salesforce1 is a viable option to perform certain actions our users want to do from a mobile device.

I've worked through all steps from the documentation, and I'm able to log in, but I am then redirected to the Classic interface:

SF1

PS1: Documentation states the following, but doing so also just rerenders the page in Classic in my browser (while this does work for internal users):

Without this setting, community members must append /one/one.app to the community URL (for example, https://universaltelco.force.com/customer/one/one.app) to access the community via Salesforce1 from a supported mobile browser.

PS2: Not sure if related at all, but I cannot find this setting anywhere. We are using a custom login Visualforce page and redirecting to a next Visualforce page after that, which seems to be working fine.

4

Solution seems to be a bit more complicated (and more custom than you'd expect)

Answer based on this document: Code implementation considerations when using custom Login, Landing or Authentication pages for Salesforce1 Communities

STEP 1 the controller apex class that gets the landing page after login should have the following code added:

public PageReference forwardToStartPage() {

    return Network.communitiesLanding();

}

STEP 2 the custom VisualForce page that handles the communities landing, in the first line of code

action="{!forwardToCustomAuthPage}"

AND you must implement something like this (and this is where the documentation fails because the code sample doesn't compile nor does it support Android or anything else besides iphone.

public with sharing class CommunitiesLandingController {

    // Code to invoke on page load.
    public PageReference forwardToCustomAuthPage() {

        if(UserInfo.getUserType() == 'Guest'){
            return new PageReference('dealers/DC_Custom_Login_Page');
        }

        //Get useragent
        String userAgent = System.currentPageReference().getHeaders().get('User-Agent');

        // Regex for useragent
        Pattern myPattern = Pattern.compile('Mobile|iP(hone|od|ad)|Android|BlackBerry|IEMobile|Kindle|NetFront|Silk-Accelerated|(hpw|web)OS|Fennec|Minimo|Opera M(obi|ini)|Blazer|Dolfin|Dolphin|Skyfire|Zune');
        Matcher myMatcher = myPattern.matcher(useragent);

        if(myMatcher.find()){
            return new PageReference('/one/one.app');
        } else{
            return null;
        }
    }


    // Code we will invoke on page load.
    public PageReference forwardToStartPage() {
        return Network.communitiesLanding();
    }

    public CommunitiesLandingController() {}
}
2

Regarding your PS2:

As your link states:

Easily link to Visualforce pages from other Visualforce pages in Salesforce1 by selecting the checkbox under Salesforce1 Settings for Communities in Communities Settings.

This checkbox can be found in Communities Settings:

enter image description here

  • Thanks, overlooked that one. It is not solving my problem though :-( – Robin De Bondt Apr 11 '17 at 14:17

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.