6

The view of my custom object is overwritten by a Visualforce page for my desktop users. This VF page should not be visible for my mobile users.

Before I render my VF page, I check the device to redirect my mobile users like this:

VF page:

<apex:page standardController="Travel__c" extensions="TravelCtrlExt" action="{!doDeviceDetection}">

Controller:

public PageReference doDeviceDetection() {

        PageReference result = null;

        Boolean isMobileDevice = false;
        String userAgent = ApexPages.currentPage().getHeaders().get('USER-AGENT');

        if( (userAgent.contains('iPhone')) || (userAgent.contains('iPad')) || (userAgent.contains('Android')) ) {
            isMobileDevice = true;
        }

        if( isMobileDevice ) {
           result = stdCtrl.view();
           result.getParameters().put('nooverride', '1');

        }

        return result;   
    }

This should redirect my mobile users to the standard view of the record, but it doesn't work. The mobile users get stuck in a loop.

  • 1
    This was a bug that I recently submitted a fix for. Is it still happening? – Kris Gray Jun 23 '14 at 19:13
  • @KrisGray sure, it's still happening. Where did you submit the fix ? – David Renz Jun 25 '14 at 13:31
  • 1
    Next release, the one going out in a few weeks. Sandboxes should already have the fix. – Kris Gray Jun 26 '14 at 19:38
  • 1
    I don't participate in the release notes portion so I don't. The issue seems small enough that it wouldn't get documented. – Kris Gray Jul 15 '14 at 17:37
  • 1
    This should work now right? Can it be closed? – Kris Gray Aug 13 '14 at 17:50
1

This Bug is fixed now, thanks @Kris Gray for your effort.

But I realized that you should not use PageReferences in Salesforce1.

For me, the solution was very simple, I deactivated the Available for Salesforce mobile apps Checkbox of my VF page.

|improve this answer|||||
  • I'm having the same issue here. but i can't deactivate Salesforce Mobile access to the page, as it completely hides the Edit button in Salesforce1. have you found any other workaround for the issue? – VarunC Jan 2 '15 at 7:10

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.