Hi there, welcome to the Salesforce Lightning Layouts. Here you can drag and drop to move pieces around, build any number of custom reusable components or just grab some from our handy stash of premade. These are so easy to build we go off running to build them, but not everything ages well and now these pages are getting harder and harder to manage. The users asked me to move a field over a column, no big deal should take two seconds now, except we made this a custom component and now I have to go grab a developer again, whoops not so simple. Also my users are asking me to add stuff to the page, but the other team doesn’t want the same thing but now they want to add something else. I can control this but at what point is this just all too much.
Lightning Experience gives us awesome power to customize everyones visual experience, but without a strategy to maintain it we can set ourselves up for even more work than we want. Here’s some guidelines I’ve learned to live by to keep my Lightning pages awesome, instead of just exhausting.
Lightning Layout Custom Component Size
Custom Components in Lightning Pages are amazing, fast to build and easy to use. While they may be quite easy to build, its very easy to get caught up in just building everything as one component. After all if its in the same section already why start from scratch. This works until someone makes a small request that requires untangling and starting from scratch.
Take the example above, where on a lead record we want to keep some information always handy. While this component is fairly small this isn’t a problem. After a while, however, we’ve added so many fields the location no longer makes sense and we want to more the fields to the main part of the page, but keep the custom buttons. Now we need to pull apart the component and the larger it got the more work it becomes. The worst part following the guidelines below it could have all been avoided. There is no right or wrong answer but asking if any of these are impacted can save you time in the long run.
Pieces that do different things
When building if you have multiple functions like the example above consider splitting into multiple components, especially when the component is referring to the record you are looking at and not a related record.
Data Sources From Different Records
While we may want to see information from a combination of different record sources putting all the information in one component can make it troublesome to locate the source of information and modify the component going forward as it may have other dependencies.
Information Looks Squished Already
It is easy to ask to add to existing components, if your component already looks very full from day one adding may be difficult in the future. Consider smaller components in the same column over one very long component from the beginning.
Lightning Layout Component Visibility
Using component visibility can decrease the amount of time it takes to create a new page. There is however a price to be paid fif we try to share pages with too many users with different roles. Soon the edit page is so full of components its easy to forget who can see what when they log in to the age. I use a 60/80 rule. For users to share a page they should overlap between 60% and 80% of the components they should see. The smaller the page, the lower the percentage can be. When that page starts getting longer and the percentage isn’t growing with it, it may be time to clone that page and send those users on a different page journey.
Share Early, Share Often
Finally, this concenpt is one that has already been embraced by the Salesforce community in a way I have never seen elsewhere. When looking for help with Salesforce there is no shortage of help on line whether in the Communities themselves or on Stack Exchange. However, we sometimes overlook sharing on a more local level, within our own companies. By the time an idea gets to Stack Exchange its very near production ready, but alont the way many permutations of the same idea were made. Sharing these ideas within your own company allows you to give context you cannot in our digital communities and may help inspire other teams along the way.
This may seem like a fast way to sign up for more work, but its a great way to increase collaboration between teams. The more the teams mwork together the more you can shop and share and Lightning Component and Lightning Web Components are a great place to start sharing.
So what do you think? What things do you do to keep your Lightning Layouts Lightning fast?