Wednesday, December 7, 2016

Transitioning to Lightning from Visualforce

Salesforce are pushing, and pushing hard, for customers to transition into the newer Lightning UI. That's not to say that Visualforce is going away any time soon, but it's time to think about moving with the cheese!

Where to start?

Choose a migration strategy

Mike Topalovich did a great blog series and presentation on migrating from Visualforce to Lightning.

In Part 1 he covers the background on Visualforce and Lightning so you know what each is an isn't.
In Part 2 he covers the roles Visualforce can play in Lightning.
Finally, in Part 3 he covers migration strategies for getting an existing org into Lightning.

Adopt the Lightning Design System in Visualforce

I recently completed a project to create a public facing Sites page for some Salesforce data. As it was a new project I thought I'd use a Lightning App and components to put it together. However, as at Winter'17, a Visualforce page that is rendering in a public facing site won't work if it contains a Lightning Component.

Instead I opted to use the Salesforce Lightning Design System (SLDS) with existing Visualforce components. I found this to be a good introduction to the SLDS as I was still using the very familiar Visualforce components.

The first thing I realized about the SLDS was all form and no minimal function. Take the Trees for example. You get a collection of CSS classes and attributes to apply, but must provide all the JavaScript functionality to apply and toggle those classes and attributes as required.

As part of the design for this new page I tried to focus all the page content into separate Visualforce components that communicated via JavaScript. Hopefully with the features come to use Lighting components in this scenario the transition will be easier.

See also, the Trailhead Lightning Design System module.

Locker Service

Coming back to needing to provide all the JavaScript logic to use the SLDS, it's important to consider the compatibility of any third party code you are bring in with the LockerService. See Introducing The LockerService For Lightning Components

Getting helps - Salesforce StackExchange

As always, the Salesforce StackExchange postings on lightning and lightning-components can be great resources for specific questions.

I found these ones in particular interesting:

Developer Tools

The following tools can make if much easier to develop and debug lightning components

Trailhead

At the time of writing there are 11 modules on Lightning in Trailhead targeting developers.