Lightning Fun: breaking up with page layouts

I don’t know about you, but one of my favorite parts of Lightning is the Lightning Record Page. Being able to organize and layout a page so that anyone can find what they need in a snap is like magic! Gone are the days of scrolling through a hundred fields to find the one you need. Gone are the days of having to click from the account to a license to an opportunity to a contact and back again. I can see what I need, where I need it, when I need it, and all with clicks, not code.

Sorry, classic page layouts, I’ve found something new!

Unfortunately, I can’t walk away for good. The classic page layout is still used for the record detail, to determine which related lists you can add, and customizing button menus. That being said, here are my Lightning workarounds to start ghosting the page layout.

Getting Organized

How do you start designing your Lightning Record Pages? I start with a pencil and a notebook. Take a close look at your existing page layouts. Who is looking at this record? What is the information they need to see first? What is the information that they only use periodically? Do they only need it when certain conditions are met? Do they frequently access other objects that are related to this record? Once we’ve answered these basic questions, we can start to think about a layout.

The Important Stuff

Important information should always be front and center. Does this information need to be edited frequently? If it’s pretty static, consider adding it in the Highlights Panel. You can display up to 11 fields here, but I like to keep it to 5 or 6. If your important information needs to be edited frequently, consider breaking out a field set that is always visible. I like to add a section in my side bar for this.

Using Quick Actions, we can create an Update Record action that will store and display our important fields. Then, by adding a Related Record component to our Lightning Record Page and using the current record as the lookup, we’re able to separate these important fields from the rest of the record detail. Here’s how you do it step-by-step.

Step 1: make a list of the fields you want to include

The recommendation for number of fields on a Quick Action is no more than 10. You can add more if you really want to, but remember you’re breaking these fields out so that they’re easily found, easily edited, and easily consumed. Adding too many fields will just remind people of those classic page layouts that we’re trying to get over.

Step 2: create the quick action

In Lightning, navigate to the Object Manager and select the object of the record you’re working with. Select Buttons, Links and Actions from the options, then New Action. In my example, I’m using Cases. For action type, select Update Record. Name it anything you want that makes sense. I’m going with “Case Detail Section”. Select an icon and then add a snazzy message that gets displayed when your users edit the section. Click Save, and now we get to choose our fields. Using the list you made earlier, drag your selected fields onto the layout. This looks just like the classic page layout editor, so it should look very familiar. When you’re satisfied, hit Save, and you’re done!

Step 3: add it to the lightning record page

Back on the record you’re working with, navigate to Edit Page from the Setup gear. In the component menu on the left, locate Related Record and drag it onto the page. In the component options on the right, be sure your lookup filter is set to This Record. For the Update Action, select the Quick Action you just created. And voila! We’ve broken out our important fields and put them in a more consumable location. Pretty cool, huh?

So What About Your Other Fields?

Good question. With our important fields taken care of, we can start looking at the leftovers. Can the rest of your fields be categorized? Are they okay to stay on the record detail, or would it be more helpful if your users could easily locate keywords on a tab component? The Quick Action trick can be used again and again, making organizing your pages a breeze.

Using Quick Actions For Related Objects

This trick doesn’t just work for fields on this record. You can display fields in the same fashion using other lookups from the record. This is helpful if your users often need to view or edit details from related records at the same time. For example, a support agent may need to update contact information while working a case. Using this method, she won’t ever have to leave the case record. Another example might be to display open opportunity fields on an account, or display account fields on an opportunity. As long as a lookup relationship exists, you can display anything that makes sense to you!

To set this up using a related object, you’ll follow all the same steps, but when you get to the component options, set the lookup filter to the object you want to add and then select the appropriate Update Action.

Restricting Visibility

I’m sure I’m not alone when I say I don’t want to manage a ton of different layouts. And with Lightning Record Pages I don’t have to!! My Quick Action field blocks can be hidden from certain profiles, permissions, or even based on field values. This comes in so handy, but can also make your page editor look a bit messy. Keeping with my Case record example, when a case is open certain fields are important, but when a case is closed other fields become the important ones. For this example, I’m actually adding two Quick Actions to the page, one on top of the other. Then I apply a filter. The case closed details will only show if the case status is closed. Likewise, we set a filter on the open case details that make it visible when the case status is open.

We can also apply this to an opportunity workflow. Say we add a quick action to our opportunity record that allows sales to create a new quote. We don’t want quotes created until the opportunity is at a certain stage. Using the visibility filters, we can add logic to our component that says don’t show this unless the opportunity stage equals [whatever stage]. How cool is that?

And That’s That!

Whoever said breaking up is hard to do surely hasn’t met a Lightning Record Page yet! Do you have any tips for admins on how to setup awesome Lightning Record Pages? Share in the comments or on Twitter using #forceforfun!