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.

11
  • 1
    This was a bug that I recently submitted a fix for. Is it still happening?
    – Kris Gray
    Commented Jun 23, 2014 at 19:13
  • @KrisGray sure, it's still happening. Where did you submit the fix ?
    – David Renz
    Commented Jun 25, 2014 at 13:31
  • 1
    Next release, the one going out in a few weeks. Sandboxes should already have the fix.
    – Kris Gray
    Commented Jun 26, 2014 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
    Commented Jul 15, 2014 at 17:37
  • 1
    This should work now right? Can it be closed?
    – Kris Gray
    Commented Aug 13, 2014 at 17:50

1 Answer 1

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.

1
  • 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
    Commented Jan 2, 2015 at 7:10

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .