Considering the Move to Lightning? These 5 Tips Will Help Get You Started

Share on facebook
Share on google
Share on twitter
Share on linkedin

I have been working with Lightning Components for close to two years and despite some of the earlier limitations, I am very excited by all the recent updates to the platform. For anyone beginning or even just considering a gradual migration to Lightning, here is a list of my top 5 tips that will help give you a head start.

# 1 – Choose Visualforce pages to convert wisely

Deciding which Visualforce pages to migrate first should not be a trivial decision. I suggest you start small and look for pages that simply query data and display the results. Lightning Component development is very different from Visualforce page development. If you are not comfortable working with JavaScript, it will likely take you a while to make the adjustment.

You do not want to begin this process by taking on your most challenging Visualforce page. It is better to start with an isolated page that does not accept user input and does not do complex processing.

 

# 2 – Break up larger Visualforce pages into a set of smaller components

Once you get more comfortable creating components, you can move towards converting larger Visualforce pages. But even then, you should do it in a series of stages. You can break up your page into a set of smaller components and convert them one at a time.

For example, if you have a page that acts as a console app and it contains multiple sections, you could start by creating a Lightning component to replace each section. Lightning Components for Visualforce allow you to embed Lightning components within Visualforce pages. In this way you could continue hosting your page in Salesforce Classic until all the sections are converted and you are ready to move the entire page to Lightning Experience. It does not have to be all or nothing.

 

# 3 – Have Visualforce page use SLDS styling before creating replacement component

If you have many users on Salesforce classic and you want to slowly get them used to the new look of Lightning Experience, while also getting your feet wet, you should consider first just converting your pages to use the SLDS. The SLDS is the Salesforce Lightning Design System and you can easily reference it in your Visualforce pages by using the <apex:slds> element.

Up until recently, if you wanted to use the SLDS styling in your Visualforce pages, you had to download the latest version, then upload it back to your org as a static resource and then reference that path in your page. Not any more. Now, all you need to ensure your page is using the latest version of the SLDS is to use that one tag at the top of your page. Easy peasy!

To learn more about building Visualforce pages using the Lightning Design System, check out this excellent Trailhead module.

 

# 4 – Use Base Lightning Components whenever possible

When Lightning development was first introduced, it came with a set of built-in user interface (UI) components that would allow you to collect or display input from your users. Even though these components were helpful, they left a lot to be desired.

Base Lightning Components were first introduced in Winter 17 and the list of what components are available continues to grow with each new release. Base Lightning Components are like UI components on steroids. SLDS styling is built-in, so there is no need to figure out what CSS class names to use. From what I have read, Salesforce plans to create base lightning components to represent all elements in the SLDS. So, if you see something in the SLDS you like, at some point there will likely be a base lightning component equivalent.

Beyond the styling, perhaps the biggest benefit to using Base Lightning Components is the fact that validation is handled for you automatically. With UI components, you were responsible for creating the JavaScript to enforce validation for your input controls. If you wanted to make an input field required, you had to write code in the JavaScript controller to handle this and display a message to the user. With base lightning components, all you have to do it set a required attribute to true. This will really help to speed up Lightning application development in my opinion.

 

# 5 – Use the Lightning Data Service whenever possible

Another big release in Winter 17 was the Lightning Data Service (LDS), which is currently still in developer preview. Visualforce developers can think of this as similar to a standard controller, but for Lightning components.

For simple components that only need to access a single sObject and use the recordID as the basis for the query, the LDS is definitely the way to go. I say this for two big reasons. The first is that components built with the LDS will likely render faster since it is built on a highly efficient local storage that is shared across all components.

Reason two is that security is built right in. Visualforce developers have been spoiled because Create-Read-Update-Delete (CRUD) and Field Level Security (FLS) access was handled automatically. This is not the case for Lightning components, where you will have to handle this manually in your Apex code to ensure proper access. By using the LDS, you do not have to worry about these permissions. In fact, in most cases you do not have to worry about including Apex code at all. See why using it is so cool?

 

I hope these tips help you in your migration to Lightning Experience. Interested in learning more? Synaptic AP’s team is always up-to-date with the latest LEX development and are here to help with your migration. Contact Us to learn more.

 

Leave a Reply

We use cookies to ensure that we give you the best experience on our website.
If you continue to use this site we will assume that you are happy with it.