Sunday, 6 December 2015

IOS and Visualforce in Salesforce 1 app Hicups

Lighting is out and looks like its  the future of customization of Salesforce 1 mobile pages .Speaking of present still we have large number of apps having visualforce page for the Salesforce 1 app build using either angular(or other frameworks ) or plain old visualforce styled to responsive design .

This blogpost is sharing some insights into common issues that I encountered with Visualforce inside SF1 container when I was testing the functionality with iPhone or iPad.


Lets list all of them one by one and list the work around for issues as these have no proper fix and are logged as issues by SFDC


1)Key freezing issue with HTML input tags


This is one of the primary issues that's  really show stopper .If you have a visualforce and you use apex:input or normal HTML input and double tap the cursor on the text field you will notice that your keys are freezed and text you enter dont appear on the input box .


This looks to be serious issue with new version of IOS and Salesforce 1 app .Even you are using twitter typeahead for autocomplete or lookups this issue can be easily observed and keys will freeze once you make selection .


The workaround for this is to include a small script at the bottom of the page that resolves this .Please note this is a workaround until this is fixed officially



2)Not able to scroll the iframe embedded in Visualforce inside SF1 container for iPad or iPhone 

This is another common bug and has something to do with IOS webkit inside SF1 .The workaround is below small snippet that adds scrolling behavior needed



There are also certain things that we need to note about navigation pattern we follow in SF1 specific apps

1)When navigating to the external world the right function to use is as below

navigateToURL(​url​[, isredirect])

If you want SF1 container not to remember the history set redirect parameter to the true state.

2)Use back function to navigate to the back and use redirect parameter as true if you want your page to refresh

back(​[refresh])

Using frameworks to develop SF1 apps can increase the speed of app build .Also for complex SF1 visualforce page if you have too many actions and you are packaging for as an appexchange app its worth to write some automation testing using selenium or using protractor whatever you feel comfortable just to not scratch your head if something breaks later due to SFDC releases or due to some code change during upgrade.

I hope you enjoyed this post and will help you troubleshoot issues with SF1 app

Introducing Lightning Base Components

Lightning Base Components are great addition to the platform and in fact revolutionary .One of the concerns around lightning component ...