Lightning Component Dev Tips

After officially starting my first “work” Lightning component, here are some tips learned so far when developing a lightning component.

Disable Browser Caching In Dev Sandboxes

One thing I noticed immediately was that after saving changes to a component, you have to refresh the page at least twice for the latest changes to be seen. Given that Lightning takes, at least, 2-3 seconds per page load, this really slows down development time.

The answer is to disable the “enable secure and persistent browser caching to improve performance” Session Setting.

Classic Steps

  1. Open Setup in Salesforce Classic. I haven’t found this setting in Lightning Setup yet.
  2. Under Administer, Security Controls –> Session Settings.
  3. Uncheck “enable secure and persistent browser caching to improve performance” under caching.
  4. Save at the bottom of the page.

Lightning Steps

  1. Click the gear at the top right and click Setup.
  2. In the left nav, expand Security and click Session Settings.
  3. Uncheck “enable secure and persistent browser caching to improve performance” under caching.
  4. Save at the bottom of the page.

Many thanks to the Slackforce community, especially Matt Simonis and Craig Ceremuga, for sharing this information.

Debugger; & Breakpoints Are Your Friend

With much of the Lightning framework handled on the client side in the browser, one can leverage the browser’s debugging tools to troubleshoot and step through Javascript as needed.

I’ve returned to an old friend, the “debugger;” statement, to put in temporary programmatic breakpoints in my Javascript code so I can inspect the code as it runs. This has been especially helpful troubleshooting AJAX calls from the component controller and troubleshooting events.

Attach Browser Events To Container Elements

One problem I’ve ran into is that sometimes a Lightning base component, such as a lightning:card, doesn’t have an event handler that I need such as “onclick”. Also, the framework disallows adding custom event handler attributes to Lightning base components that don’t support them and you’ll get a compiler error if you try.

My solution is to wrap the Lightning base component in another HTML element, such as a div, and attach the desired event to it.

I’m not a big fan of this workaround but it’s easier than using one of the “aura” components and then styling it for Lightning. If you have a better way to do this, please share in the comments below.

Attach Data To Element Data Attributes For Later Use

To the best of my knowledge, you can’t pass parameters directly into a browser event method handler when it happens. For example, you can’t do this:

In order to access some contextual data in the event handler, I’ve resorted to adding “data-” custom attributes to HTML elements that can then be accessed by event handlers in the component’s controller. This has been particularly helpful for elements that are rendered from within an aura:iteration, usually when iterating over records. Here’s an example of this approach:


Component Controller

Leverage the Lightning Design System Styling

Use the Salesforce Lightning Design System (SLDS) to ensure your components will look like Lightning. Don’t forget you can add slds- classes to your elements to easily stylize them!

Leverage the Lightning Component Developer Guide

The Lightning Component Developer Guide provides an in-depth resource at developing Lightning components. It also acts as a good reference for the aura and Lightning base components.

What tips do you have for developing Lightning components?

Reflecting on 10 Months in Business

While it’s technically a week shy of 10 months, close enough.

What’s New

Awesome New Client!!!

This contract started in April and it’s been great. The people are smart, friendly, know what they want, and are easy to get along with. I was onsite for a week and provided training and other services. Also, the work is interesting and I have the opportunity to do more Lightning development.

Turned down additional work.

The prospect from March reached out to me recently asking if I’m available for an urgent project they have but unfortunately I’m not. Instead, I referred them to some colleagues who will provide what they need. We kept the door open for future engagements.

More Lightning Development.

I’m currently implementing my first official Lightning component that’s like a Kanban board where one can drag-n-drop various items from one column to another.

Overall, the UI looks better but currently I still prefer developing, from a developer’s perspective, in Visualforce because performance is better, the amount of coding required is less than Lightning since more code is needed for basic plumbing and wiring, and the overall infrastructure is better.

There are also little things, such as Locker Service, that drive me nuts in the name of security. For example, I can’t add a custom attribute to a Lightning base component or even add an onclick event attribute to one.

Another little thing is always having to remember to add the v. prefix in {! v. } bindings to access attributes. I wish specifying the attribute alone was enough like it was in Visualforce and the framework could figure out where the binding originates.


Matt Addy and I started a Salesforce Slack team named Slackforce where Salesforce professionals can hangout and have real time communication with others. See Introducing Slackforce for more detail and on how to join.

One nice, somewhat unexpected, benefit of Slackforce is that it has helped fill the “Missing Professional Camaraderie” void by helping connect to many great professionals I’ve worked with in the past and present.

Changed Student Loan Payment Option

When I started the business, I changed my student repayment option to the graduated, extended 25 year plan so that my monthly payment would be the lowest possible because my revenue expectations were projected but unknown at the time.

With business doing well and my confidence in it steady, I’ve switched my student loan payment back to the graduated plan so that I can still pay the loans off within the original 10 year timeframe, which is in 4 1/2 years.

What’s Next

More Lightning

This recurring theme will most likely stay for a while since more and more people are showing interest in it. Additional blog posts are coming too.

Learning Other Salesforce Technologies

With Salesforce, there’s always something more to learn. Besides Lightning, I want to learn more about:

Platform Events – This native messaging bus could be very interesting for integrations and other pub-sub type architectures.

DX – I am now in the pilot but have to still try it. It’s on the backlog.

Einstein – Another thing on my learning backlog.

Keep Expanding the Network

Slackforce has helped with the networking goal but I want to keep expanding so I’ll do this by getting more involved in the community by attending conferences, meetups, open source projects, and other activities.

No Upcoming Product

I’ve given some serious thought about doing a Salesforce product but have decided against it for now because I’m not that passionate about the product idea I have. If I’m going to build something, I’m going to be passionate about it.

How’s your business or professional goals going for 2017 and how will you reach them? What’s your experience with Lightning been like?

Related Posts

Tips Getting Started in Freelancing

People have been asking me lately what it’s like to get into freelancing and how they could do it. Here’s my advice and tips for taking your own plunge.

Financial Reserves

Have at least 3-6 months of cash on hand because you may not have any customers at first or that project that was going well may suddenly come to a halt.

Not sure where your money is going? You better find out how much you’re spending because Freelance income is very lumpy. You’re not getting a steady paycheck any more.

I personally like Personal Capital since it aggregates all your financial accounts into one place and does various financial analysis like keeping track of your expenses, income, and your net worth.

Have Customers At the Outset

If possible, have paying customers before you quit your day job so you have some income still while growing your book of business.

Personally, I didn’t have any customers when I officially started in the beginning of August. However, I had a few leads that eventually became customers the first couple weeks in business. Looking back, that was rather risky but I had financial reserves and I knew I could find a job quick if I had to so it was worth doing it, for me.

Follow Your Passion Do What’s Valuable

Besides my family, my passions in life are technology, helping others, building things, and learning new things. Doing Salesforce tech consulting lets me accomplish all those passions and I get paid to do it. It also happens to provide great value to my clients since they get the software, training and other work needs to make their business better.

Note: I originally had “Follow Your Passion” but striked that out because it didn’t seem as accurate.  The “To find work you love, don’t follow your passion” TedX video conveys my feelings about this better than I can. As Benjamin Todd puts it, I’ve mastered something through achievement and it provides me meaning aka purpose.

How To Find Customers?

Most people that knew me before I got started have asked me how do you find customers. So far, my two primary sources are My Network and Recruiters.

My Network

Letting people I know that I went into business for myself has brought in business. For you, this could be former employers, family, friends, people in volunteering organizations, clubs, or even gaming clans, guilds, and so forth. If these people can’t be customers, they may know someone who potentially could be so they may give you some leads of people to talk to.

When these people help me out, I’m always on the look out to bring them business or help out in some other way too.


Finding good, qualified Salesforce professionals is hard. There’s a real shortage so it’s a pretty lucrative field, at this time. Thankfully, there are various recruiting firms out there that help consultants match up with clients and vice-versa. They get a take but the money, and more importantly, the connections you make are worth it.

One recruiter I’ve worked with lately, TJ, is outstanding. I told him what I have to offer, what work I’m looking to do and only brought things by me that matched my criteria. That’s better than many other recruiters who just throw every potential job at you even though it’s not a good fit.

Other Sources

  • Job Boards – Look at various job boards such as Monster, CareerBuilder, Dice, etc and apply to contracting / consulting listings. You could try applying to full-time listings too but only as a consultant but recommend the former first since this may not be as easy and I suspect many hiring managers will simply pass you over.
  • Advertising / Marketing – Try advertising your services and/or products. This could be social media ads, an email campaign, tv commercials, radio commercials, signs, and other advertising forms.

Personally, I haven’t pursued either one really. My biggest “marketing” activity is posting the occasional tweet or LinkedIn message to a Metillium blog post.

If you have other ways to find clients, please share them in the comments below.

Have a Website

Almost every business today has a website and so should you.

It shows the world and potential customers who you are and what you’re offering. It also shows that you’re credible. For example, I primarily share out Salesforce and Microsoft blog posts to share out what I’ve learned but it also shows people that I’m credible and have skills that can help them.

Note: This website doesn’t look like a traditional “business” website and it’s on my to-do list to revamp it a bit but it’ll be a while.

Structuring Your Business

There are many ways to structure your business such as a Sole Proprietor, LLC, S-Corp and others. Many people pursue the LLC or S-Corp formation for liability protection and/or potential tax benefits. There are many considerations to this and recommend talking to a lawyer first.

The good thing is that if you decide to incorporate as an LLC or S-Corp, it’s fairly easy to do but a lot of paperwork. You could do this yourself but recommend paying a few hundred bucks to have someone do it for you.

Health Insurance

Besides paying myself, health insurance is my biggest expense.  In western NY, family bronze to gold plans are $800 – $1,600 per month for individual plans. That’s roughly $10,000 – $20,000 annually, which is insane, and that’s just for premiums. You may have to pay out-of-pocket up to your deductible too depending on the plan you have. Thankfully, depending on your income, you may be eligible for subsidies and pay a lower monthly premium.

Bottom line, explore what your health insurance options are.

Liability Insurance

I also recommend looking into liability insurance so that insurance can pay out for any law suits that are brought against you. It only takes one mistake that could potentially cost you your business and potentially your personal assets.

Remember It’s About People

For consulting in particular, remember it’s all about people so always be courteous, on-time, polite, and always do a great job. These things usually lead to more business in the future by allowing people to refer you to other potential business.

Also, don’t forget to reciprocate. If someone brought you a lead or business, help them out somehow too. For example, even though I may not be hiring, if other people I know that are good are looking, I’ll ask around to see if someone may be hiring and if so, forward the job seeker the potential employer’s information.

Have a Good Team

No one can do everything themselves so outsource what you’re not good at or don’t want to do so you can focus on what you’re good at and want to do.

For example, even though I know accounting, I outsource that to a CPA firm referred to by a colleague and absolutely love my accountant. If you’re in Western NY, I can’t recommend enough, Dan Matteo at the RDHB CPA Firm in Pittsford.

Let us know in the comments what tips you have for getting started in freelance and what you think of the tips here.

Introducing Slackforce

A colleague of mine, Matt Addy, and I had a conversation the other day. It went something like this:

Matt: We should start a Salesforce Slack team where the Salesforce community can hang out and chat about things.

Luke: That’s a great idea! You should start it.

Matt: Ok done. Here’s the invite and let’s get others on here.

Introducing Slackforce, yea we’re marketing guys… not really. Slackforce is a Slack team, an online chat tool, where Salesforce professionals can come hangout and discuss Salesforce related topics. It’s free and so far we have 11 members.

So far, we’ve had a few discussions about Lightning and different tools.

Joining SlackForce

If you’d like to join, please send me a message on the Contact Page asking to join along with your email address and then I’ll send you a Slack invitation. We look forward to meeting you!

Note: The email is needed because the free version of Slack is being used so existing members have to invite new members to join.


P.S. Thank you Matt for having this wonderful idea and getting this started so quickly.

Salesforce Summer 2017 Release Review

I know I know…. a few weeks ago I reviewed the Winter Release and the Spring Release. However, all the cool kids stay on top of the latest releases so here I am writing my review of the upcoming Summer 17 Release.

To see the complete list of new features, look at the Summer 17 Release Notes PDF.

Make Lightning Experience the Only Experience

Ready to move from Salesforce Classic to Lightning Experience without looking back? Just hide the option to switch to Salesforce Classic from your Lightning Experience users so that they stay in Lightning Experience. This feature is new in both Lightning Experience and Salesforce Classic.

By default, when you enable Lightning Experience, your users get the Switcher, allowing them to switch back and forth between Lightning Experience and Salesforce Classic. But if you want some or all of your users to stick to Lightning Experience, you can remove the Switcher (1).

In Setup, enable the Hide Option to Switch to Salesforce Classic permission (2) in profiles and permission set.

Usually my recommendation is to allow the users to choose what they’d like to use so potentially limiting some or all users from switching between Salesforce Classic and Lightning Experience (LEX) is interesting that Salesforce allows it. My guess is that Salesforce will make this option defaulted in upcoming releases to discourage the use of Salesforce Classic but we’ll see. My recommendation is to leave the switcher on unless there’s a compelling reason to have it off.

Ditch Your Mouse—Keyboard Shortcuts Are Here

You can now use keyboard shortcuts to maximize your efficiency and speed while working in Lightning Experience. You can search for, edit, save, and close a record—all without touching a mouse. We’ve even got keyboard shortcuts to help you go to the publisher and post to a feed. So start planning what you want to do with all the time you’re going to save! By default, keyboard shortcuts work in all Lightning apps. This change applies to Lightning Experience only.

It’s the little things like this that really make a difference. For heavy data entry, this is a life saver and really speeds things up. Thank you Salesforce!

Access Field History Related Lists in Lightning Experience

Field History is one of my favorite features in Salesforce. It’s one of those things that’s nice to have when you need it and really make troubleshooting / auditing hard when it’s not on. While I don’t use it daily, it’s nice that it’s now accessible in LEX.

See Results from External Search Engines with Federated Search (Generally Available)

Salesforce makes it possible to search external content from within Salesforce with Federated Search. It’s now easy to connect external search providers to your org with the Salesforce OpenSearch connector. Users stay inside Salesforce to view Salesforce records and external search results, saving time and hassle. This change applies to both Lightning Experience and Salesforce Classic.

While this doesn’t sound very sexy, this could be really helpful for an organization with many different systems by allowing them to be searched from within Salesforce after creating various search connectors. With so much information available today and it growing faster and faster each year, being able to aggregate it and search in one place could save significant time, potentially. I’m adding this to my backlog of items to R&D further.

Lightning Sync & Lightning for Gmail Generally Available

These two offerings let Salesforce connect with Gmail and keep your email and calendar synched with your Salesforce data. Very helpful for Sales reps!

Various Wave Enhancements!

Wave is Salesforce’s analytics offering. It works by having you import various data into it and then being able to slice-n-dice the data in various ways afterward. Under the hood, it uses Hadoop to store the information and a variant of PIG called SAQL to query the data.

One new feature that’s now generally available is Wave Connectors where an admin can create a connector and have it connect to your current Salesforce org, other Salesforce Orgs, AWS, or a PostGres database on Heroku using click and not code. I’ll be more excited when other connectors are created for SQL Server, Oracle, and other widely used persistent data stores.

Wave is another one of those items of my R&D backlog. If you’ve used Wave, let me know what you think of it in the comments!

Move Communities Between Orgs with Change Sets

You asked and we delivered! Change sets are now available for Lightning communities and Salesforce Tabs + Visualforce communities, making it easy to move your community between orgs that have a deployment connection. Create, customize, and test your community in your sandbox environment and then migrate the community to production when testing is complete.

This makes life much easier. Setting up a new community can be a time consuming process depending on how many settings are customized and other changes. The changeset can’t be used to create a new community so one still has to create the initial empty community but then a changeset can be used to migrate the rest from a source org into the destination org.

Power Up Your Lightning Pages with the Flow Component (Generally Available)

This may be the most exciting feature for me that’s coming in the Summer Release. Granted it’s been available for a while now but having it Generally Available means that I can really recommend it to my clients and use it more. For a lot of things, Flows in LEX can be used. I’ve only scratched the surface. For some other ideas on it, check out my Flows in Lightning Experience.

Embedded Login Enables Users to Log In to Your Website

Salesforce introduces the Embedded Login feature to authenticate your website’s visitors. Your web developers can add login capabilities to the website with just a few lines of HTML. Embedded Login connects your website with Salesforce. This feature works for communities created with either our Communities or Salesforce Identity products. This feature is new in both Lightning Experience and Salesforce Classic.

Embedded Login is another option for customers who want to authenticate their users through Salesforce, but their website doesn’t support user authentication through SAML or OpenID Connect

This is the second most exciting feature coming out in Summer for me. I can’t tell you how many hours I’ve spent working with vendors trying to implement Single Sign-On with Salesforce as the identity provider using OpenId. This sounds very promising but will have to see this in action to confirm.

Einstein Vision Is Now Generally Available

Sign up for Einstein Vision to receive 1,000 free predictions per calendar month. If you need more predictions, you can purchase them.

Salesforce has touted Einstein since Dreamforce with their Dream House app. I’m glad to see that it’s now Generally Available and allows up to 1,000 free predictions per month. This is another item on my R&D backlog.

What’s your experience with Einstein been like?

Safely Cache Values with the New Cache Builder Interface

The Cache.CacheBuilder interface makes it easy to safely store and retrieve values to a session or org cache. A Platform Cache best practice is to ensure that your code handles cache misses by testing cache requests that return null. You can write this code yourself, or you can use the new Cache.CacheBuilder interface.

The documentation is a little vague around this but it sounds like we now have session and application based caching on the platform. I’ll take a look at this in more depth once the release is out.

Validation Rules for Custom Metadata Type Fields

This will allow admins to provide much better data integrity for custom metadata.

Custom Metadata Types Support Long Text Areas (Generally Available)

Being able to store more than 255 characters is awesome. This is usually for specialized markup, SOQL Queries, and other things that require long values.

What are your favorite Summer features?