A Few Tips When Developing Lightning Components in Salesforce

by | Jan 8, 2016 | Salesforce | 1 comment

This week I have been diving into developing Lightning Components and have been really excited how I can build some common business UI as a re-usable component I can just drop onto the Lightening App Builder page.

UPDATE: Well it looks like I was wrong about appHostable as this actually works when I created a new developer instance. So looks like even though my original instance was on 16 it doesn’t have everything enabled. All good learning experience.

L1

The above image shows a test component I originally created when I was learning how to build one. It took me a little while to get things working due to changes in Salesforce software releases and working out what was the old way to code against what was new.

Interestingly if you watch the videos in the Lightning Components Trailhead the code shown in the video is out of date. I guess as things are still being developed on the platform, its difficult to keep in line.

First thing to watch out for is the implements attribute on aura:component. Originally it looked something like this:

<aura:component controller=”ContactController” implements=”force:appHostable” >

In the release 16 I am using the force:appHostable is now:

<aura:component controller=”ContacController” implements=”flexipage:availableForAllPageTypes” >

So be aware of this as your component won’t show in the list of Custom Components if you use the old implements.

The other tip is that you no longer need to create a Lightning Component Tab to implement your new component. This option is no longer available in the Setup / Tabs section and you should just create a Lightning app page, where you will automatically see your component in the left panel.

I hope these few tips help you as they were a couple of annoyances for me when I started out coding the components. If you have any questions of further tips then please leave a comment.

 

Spread the love