1

Problem: In Salesforce1, I have an Action button that opens a Visualforce page, which then tries to redirect to a second VF page. When this occurs I get an error in Salesforce1: "You can't view this page, either because you don't have permission or because the page isn't supported on mobile devices"

Details: I have an instance with a customer community. There is a custom object called Occasion, and community users have CRUD permissions to the object. There is a custom Action button for Occasion which loads a Visualforce page. There is an action parameter on this VF page. Th action method in the controller compares the occasion date to today -- if the date is in the past, then it is supposed to redirect to a second Visualforce page.

The redirect fails in Salesforce1, but it works in a standard browser.

Question: In the debug log, I see that the second Visualforce page is not loading for Salesforce1. Any ideas why the "Can't view page" is happening?

The error occurs for both community license users and for sys admin users in the community. I have verified the page and object permissions for profiles, the page permission in the community, the "Available for mobile" checkbox on the two pages, and the setRedirect() method in the first VF page controller.

This old Known Issue refers to inline VF page issues but I have a custom action button, and the issue was supposedly fixed in Summer 16 anyway.

1

As this works in the browser and not in the app, maybe this is due to the redirecting to the page not working in the app. You can try using this JS code in the VF page to redirect in browser or app.

<apex:page standardController="Account" sidebar="true" showHeader="true" standardStylesheets="true" id="vfpage">
<script type="text/javascript">
var link = document.getElementById("vfpage").action();
if( (typeof sforce != 'undefined') && (sforce != null) ) {
    sforce.one.navigateToURL(link);
} else {
    window.location.href = link;
}
</script>
</apex:page>
  • Thanks, it turns out this code was in the second VF page but not the first one, so I placed it in the first one and the redirect worked in SF1. – David Cheng Oct 7 '17 at 0:52

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.