Rolling up the sleeves with VisualForce
I wrote the other day that VisualForce was the real deal. I wanted to follow that post up with some more thoughts now that we’re actively developing with it.
First, let me say that we are trying not to write any S-Controls anymore. One reason is that S-Controls have a shelf life baked into them. At the top of my S-Controls I include Saleforce’s AJAX toolkit, which is what makes them so powerful. But, a bunch of my code was still using an old toolkit (circa way back in 2006) that is no longer getting updated. That’s fine with me–all my new development was always with the new toolkits. But, when Firefox 3 came out, all my code with this very old toolkit broke because of something with Firefox. I have no idea why, but it did.
With VisualForce, there are no includes of files that will go obsolete. So it is the most future-proof way to build UI in Salesforce short of hosting everything yourself.
Second, after spending years building S-Controls, VF is a dream to work with on so many levels. In that earlier article I talked about the big architectural reason why it’s better. Some practical realities have hit home since I’ve been writing actual production code.
- Testing is the gift that keeps on giving - UI that I write with VF has all it’s logic in Apex classes. I can write tests for these classes. Testing is massively helpful in creating, understanding, and maintaining code. I can’t overstate it’s value.
- Deployment is getting much easier - moving code around has massively improved with the new metadata api. Just yesterday I dragged-and-dropped VF with Apex classes from a sandbox into production. It just plain worked. I was shocked, but it shows how much implicit respect I have for the Sf.com development team that I even tried it. I find myself constantly trying things that I know probably won’t work, and very often things just work! Kind of like using an iphone in that way.
- Fewer languages is better - All my logic is now in Apex. So I don’t have to remember how to write logic in S-Controls. Thank god. In some cases we had moved some of the logic from S-Controls to Apex webservices. Migrating this code to VF and Apex turned out to be really easy. And ditching the webservices simplifies and speeds up everything, of course.
So every new idea we have is going right to the VF drawing board. However, there still are some things to improve:
- Invoking code - you can’t hook VF into buttons as easily as S-Controls, so we’ll be putting URL calls in there until we can directly reference the pages. Nice thing is that we reference by the page name and not the ID.
- List buttons - there isn’t any way to have a list button written in VF process many checked records from a list. So we’ll have to keep writing JavaScript for these functions.
- Detail of a record in edit mode - See my idea from yesterday for this killer platform feature. I think this is a massive one for the user experience and would really compliment Apex triggers with UI based “next actions.”
- Packaging - I’m sure this will come in the next release.
As we get more proficient with VF (and testing VF) I’ll write more. But to date, I have to say I’m very pleased with the framework. This is a learning curve well worth climbing.

July 31st, 2008 at 2:29 pm
Hi, Steve
I’m a volunteer Data Analyst designing a brand new DB in SF for a Nonprofit in education . We were trying to integrate your Household and Lead conversion tabs with our donor DB when S-controls stopped working. You mentioned that the problem is with Firefox 3, but were using Firefox 2.0.0.16 and Internet Explorer and nothing seems to work anymore.
My guess is that this has something to do with the launch of Summer 08 and VF.
Since we are still in designing mode, there’s no harm done. We’re not dependent of your Householding system, but on the other hand we’re too novice in SF to develop our own Householding as we are just starting to learn the basics of SF.
Are you planning to develop another appex for household anytime soon? Or should we try another approach to deal with households and donations?
Any suggestion will be highly appreciated.
July 31st, 2008 at 3:17 pm
I’m not planning on updating my old Household code. But I found that migrating from the old ajax toolkit to the new one did the trick.
All that is involved in that is making a number of syntactic changes in the code. It’s not evident if you don’t understand scontrols, but it is rather straightforward for someone who does.
I might be able to help you with this as a personal consulting project since you aren’t in ONE/Northwest’s service area. Drop me a line if you are interested.
August 1st, 2008 at 3:08 pm
Steve, thank you so much for your willingness to help us with this. When would be a good time to call you? Will you be available next Tuesday or Wednesday?
Just so you know I am not very familiar with Ajax and Javascript, but I know some Java, Perl and SQL. I have looked at the s-control codes and kind of figure how they work. I attended the Summer 08 Tour de Force and sit through the VisualForce seminars and I have an idea of what you talking about regarding the toolkit.
My teammate and I have been pouring through all the SF blogs and forums looking for a solution and we’re learning a lot about SF. So, I think you can walk me through the necessary changes in the code, if it’s not too involved.
Please feel free to email me at amasuko31@gmail.com
Thanks again
Alice Masuko