Monday, June 22, 2015

So finally the Part 2 of the #NoController series , In this part we will try to update the records that were retrieved from the Salesforce using SObject Remote.

If you haven't gone through the Part 1 of this , you can have a look here

Updating Records

  • Will be using update method of sObject Remote
  • Records will be updated as soon as the input elements losses focus (blur)

After all this was not that complicated :-)

Sunday, April 19, 2015

Rich Text Areas / Field , lets is like a small editor which lets you format your content. Thats really cool feature when you want that field to merged into a PDF / Email or in an document. But whats not so cool is when you add an RTF to a Visualforce page you no longer can rerender the page and you have to let the page refresh fully. Thats really sad.

The visualforce RTF editor uses CKEditor which is widely used for the same purpose and has an open API / Method, which exactly was the Idea behind the custom-rtf component. Introduce some JS in the page and customize the toolbar and along with bring back the ability to rerender the page.

Introducing Custom-rtf

  • Lets you customize the Toolbars
  • Lets you rerender the VF page
  • Easy to using vf component



  • targetclass : Styleclass of the Textarea that needs to be rendered as RTF
  • toolbar : Different toolbars available

Toolbar options

  • Full
  • Visualforce
  • HomePageComponent
  • SalesforceBasic
  • EmailMultiFormat
  • Email
  • SalesforceLight
  • Knowledge
  • KnowledgeWithIframes
  • ServiceCommunity


Github / Installation 

Monday, April 6, 2015

Salesforce trailhead is here for a while, but I somehow avoided it , but finally decided into jumping into the same. There is whole big list of modules in there but the one that certainly draw me to itself was Visualforce Mobile !

Trailhead really a fun way to learn stuff about platform, and really presents the concepts well.

About the Visualforce Mobile Module

This module takes you from Basic to advanced custom css to suite the look and feel of Salesforce1. It covers all of them !

  • A quick getting started
  • A quick small tour to using Salesforce RemoteObjects in visualforce pages.
  • Using global Actions
  • Talks a lot of bot Salesforce1 design and StyleGuide. Mainly focused about how to make your pages mobile 
  • Also the one-starter library
  • And finally a bit about different JS libraries like AngularJS , Ionic and Bootstrap

Why its important ?

Well trailhead is really well compiled module, and I wish I had covered this a bit before ! I have already covered similar topics in my past but it still looks fresh. At the end of the day on mobile UX does matters. A mobile user definately wants the information to be presented in a well organized manner. Something like

Trailhead was a really fun experience and awesome way to learn the Mobile Visualforce pages ! And hey there are lot many modules in there. Here are the few from my todo list

You can read them all here

Friday, April 3, 2015

Finally back after long long time!

I have been working with AngularJs for a while now and I find Angular to be really helpful to create stateless interactive pages and best part is you hardly need any Apex Controller for the same. Pages are fast, fluid and Mobile friendly (Salesforce 1).

With time I have found the best ingredient to prepare your AngularJS page are

  • AngularJS ( of course )
  • SObject-Remote (thanks to Jason Venable)
  • Bootstrap (not required)

Lets start with a simple example.

Bringing data to the page

This would be a pretty easy example where we will be using SObject-Remote to bring query data from Salesforce Accounts

The Catch

  • The area ng-controller marks the area which can access the $scope variable of that particular controller.
  • You can access variable inside $scope by using {{}}. If you have a variable $scope.accounts you can directly access that in page by doing {{accounts}}, just like regular merge field but a bit different syntax.
  • We have used $scope.$apply() , which generally tells angular to redraw the UI  / View. Since remoting works async we need to notify the angular to redraw once we have the data by calling this method.

End Result

Finally a stateless fluid page without any controllers.

Sunday, January 25, 2015

You might faced a challenged, atleast once while developing pages, where you need to rerender the page which contains a <apex:inputFile/> or an Rich Text area field <apex:textarea richtext="true"/> . There is no out of the box solution for this but there is alternative solution where you can implement a CKEditor to do so.

How can I solve this ?

I have been using ckeditor for quite sometime and eventually developed a vf component for myself called "customrtf". Customrtf is based on salesforce's rich text implementation and borrows code from it. This is the very fist version of the component, and many other features will come eventually.

What it does ?

  • Lets you convert a textarea into a richtext area
  • Allows re-rendering of the page

How to use it ?

Thursday, October 30, 2014

Finally after a really long dormant period, I have made quite a few changes in Visualstrap. Along with some minor changes, Visualstrap now works with PDF.

Main Site

How to use ?

Just set theme as "pdf"  from importvisualstrap component and you are all set.

 <c:importvisualstrap theme="pdf" />

Updated Packages

I have pushed the latest source code to git and unmanaged package will follow soon.
However I am still waiting for a fix of  to push update for the managed package

Tuesday, October 21, 2014

I have got this question several times from emails, to tweets and from lots of comments in blogs that "How can show more than 1000 records in table show that I can do more with PBE". PBE does add a lot of client side features like sorting, export, pagination etc but totally rely on data on the page to make it work, it cannot bring data from controller. So we need to bring as much as data we can to the page but to do this we need to overcome the 1K limit of list on VF.

If you haven't read about PBE (Pageblock table enhancer) you can read it here

So how can we overcome the 1K limit of list in VF pages ? 

There are basically two ways

  • JSRemoting : Use remoting and templating library like JSRender to create a table and initialize PBE on the same. I did a small blog on something very similar where you can display records using Remote objects, but for this we need to replace the data source from remoteobjects to remoting because 100records query limit
  • Using List<List<T>> : This is complete VF approach where we try to replicate the structure of pageblock table using apex:repeats.

JS Remoting

  • Very fast and lightweight
  • Can bring upto 15mb data
  • No overhead of viewstate
  • Ideal for showing long list of data

There is no better way to explain then jumping into the code.

How it works ?

  1. The page loads and brings data using Remoting method "getContacts"
  2. Once data is available the data is converted into HTML using JSrender and HTML template that is defined
  3. After load we call the initPageBlockTableEnhancerADV method to init PageblockEnahncer which reinitializes  the PBE