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?

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>
  • 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 '14 at 17:25

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.