Tag Archives: Salesforce1

Salesforce1 Tip: How to set different Visualfore page for Salesforce 1 and desktop UI

Why

If you have a basic knowledge about mobile UX, you would know that it is quite important to improve the functionality for mobile in order to improve the performance, visualisation and other device implications.
Having said that, our first approach as Salesforce developers is to minify the amount of fields, related lists and also some specific functionality in the standard page layout.
There are two ways to address that:
A) One responsive page
B) Two specific pages
In the second case Salesforce does not allow you to set an specify Visualforce page for each platform frontend: Salesforce1(mobile) or FullSite (Desktop).
How
However you can do the following:
  1. Set the standard action (View for instance) pointing your Desktop Visualforce page.
  2. Set to false the mobile availability checkbox in that VF page.
  3. Create the second (mobile friendly) Visualforce page. Be sure that you are using a standard controller if you consider to override Edit/View actions.
  4. Check It true for  “available for Mobile apps”
  5. Create a Publisher Action pointing your new VF page.
There you have ;)

About Martin Borthiry

I’m a fully trained and qualified software engineer with more than 15 years of varied experience, specialized in frontend performance, web developing , cloud computing, salesforce, as well as CRM functionalties and Social Networks. Specialties: Salesforce.com Platform & Web Performance Optimization. Salesforce.com Developer and Administrator Certified. Senior Frontend, Javascript and HTML5. Heavy Ajax WebApps Mobile WebApps – Phonegap Webapps Developer (Php/Django/Python) Team Work & Managment

Apex Tip: Simplest way to detect Salesforce 1

If you are working to adapt or create a Visualforce page for Salesforce 1, you would know that you need to detect what type of client application (mobile or desktop) is doing the request.

You would need that in order to avoid certain apex:tags that are not compatible with Salesforce1, to change the layout and look and feel and code some special lines like replace links by sforce.one.navigateToSObject(objectId);

After some research I’ve found those nice methods to detect what type of client is requesting the page

Client side (Javascript):

 

Server-side (Apex):

 

About Martin Borthiry

I’m a fully trained and qualified software engineer with more than 15 years of varied experience, specialized in frontend performance, web developing , cloud computing, salesforce, as well as CRM functionalties and Social Networks. Specialties: Salesforce.com Platform & Web Performance Optimization. Salesforce.com Developer and Administrator Certified. Senior Frontend, Javascript and HTML5. Heavy Ajax WebApps Mobile WebApps – Phonegap Webapps Developer (Php/Django/Python) Team Work & Managment