2

I have a visualforce page that I'm running in Salesforce1 on my Android phone. The page is a simple list of Campaign objects. Each Campaign in the list has a link to the associated Campaign record.

When I click the Campaign links through Salesforce1 on my Android phone, the non-mobile version of the Campaign page loads. When I open Salesforce through the browser on my Android phone, the same links correctly open the mobile versions of the Campaign pages. Here is the code for the link:

<apex:outputLink value="{!URLFOR($Action.Campaign.View, campaign.id)}">

Is there some special code I need to add to force links in Salesforce1 to always load the mobile versions of each page?

1 Answer 1

2

This sounds like a bug in Salesforce1 to be honest - if the mobile browser gets redirected I'd expect the webview that Salesforce1 runs in to get a similar redirect, so its almost like the installed app isn't checking.

You can use the Salesforce1 URL scheme to point to the mobile version of the page:

com.salesforce.salesforce1://entity/view?entityId={ObjectId}

Although you probably want to check the sforce.one object to see if you are in the Salesforce1 application and conditionally change the link target based on the context.

 <script>
   if ( (typeof sforce != 'undefined') && (sforce != null) ) {
      // in Salesforce1
   }
   else {
      // not in Salesforce1
   }
 </script>
1
  • I used the conditional checking you mentioned along with the salesforce1 navigate method sforce.one.navigateToSObject('{!record id here}','detail') and it worked!
    – Clint
    Sep 2, 2014 at 17:25

You must log in to answer this question.

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