With each seasonal release, the ability to natively surface data in Salesforce continues to improve. This has especially been the case recently with Dynamic Forms and Dynamic Actions. With Dynamic Actions, gone are the days of needing ‘Banner Components’ to conditionally show and hide components, And thanks to Dynamic Forms we now have a great deal of control over record visibility based on the viewing user, and without having to descend into the page layout management abyss. While I end up using these new tools constantly on new builds, there is another bit of UI sweetness that seems to be consistently overlooked, but that saves a ton of work in meeting user requests for surfacing data. Let’s look at it quickly — Related Lists from Parent/Lookup records.
To illustrate, let’s look at about the simplest possible scenario we can. We have Accounts and Contacts. From any Contact record under an Account, I want to be able to see all the other Contact records for that Account as well. I really dislike opening multiple tabs, and also want to those Contacts to appear without navigating back to the Account.
Do It, Do It
From the Contact record, navigate to Setup => Edit Page as we would for any Lightning Record Page update.
Drag ‘Related List – Single’ onto the Lightning Record Page. On the right-hand side taskbar, look for and select ‘Parent Record’, and change it from ‘Use This Contact’ to ‘Account Name’
In the ‘Related List’ selection, choose ‘Contacts’. For ‘Related List Type’ I like to use ‘Enhanced List’, but this is personal preference. If you choose ‘Enhanced List’ you’ll have a couple more selections to make including the ‘Number of Records to Display’ and ‘Show list view action bar’, but that’s not important for this demonstration.
Your screen should now look like this:
Save the Lightning Record Page and Activate if you haven’t already. Define as Org Default or something else depending on where you’re playing around with this.
See It In Action
On the Record Page, we now see the ‘Contacts for Parent Account’ related list, which shows us all the other Contacts for the Account of the Contact we’re viewing. This lets us peruse that list without navigating back and forth to the parent.
Important Note: Make sure that the ‘Related List’ you select for the parent object is on the assigned parent object’s layout for the viewing user. If it isn’t, then you’ll get the warning message when viewing the layout in builder/edit mode.
Keep this simple functionality in mind while building our your pages from the user’s perspective. It can make a lot of formerly very difficult configurations quite easy to execute, and I find myself using it often. Simple but effective is the best.
Thanks for Reading!