Recently I’ve been working with some fun ways to use the Lightning Page designer & various Lightning component to create better end user experiences. I’ll be posting a few more and hopefully the community can share some of your super Lightning Layout Tricks with us as well.
Conditional Record Detail Components
Use Case: Universal Promotions’ Salesforce admin, Kenny, has been tasked with showing different, editable fields for each record depending on that records characteristics. In the past, Kenny would create new record types, page layouts, and workflows to manage this request, but with Lightning Experience, Kenny has new admin super powers to deliver a cleaner, simpler solution.
Build Requirements: Create ‘Update Records’ Quick Action(s), Lightning Record Page, and Related Records Lightning Component
Example: Universal Promotions is an approved vendor to provide promotional items to MLB Baseball teams. Based on a teams total spend during the prior year, accounts are assigned a customer level; Platinum, Gold, Silver, or Bronze.
For the current season, Universal Promotions’ sales manager, Kristi, has set two growth targets for all the accounts based on their current level. Kristi wants Platinum accounts to grow by 8% minimum, with 15% as a stretch goal and Gold Accounts to grow by 5% minimum, 10% as a stretch goal.
She wants her sales team to see those goals on the account page based on the current level and to not appear for new customers, who have not been assigned a level. Kenny realizes that with Lightning Experience, the traditional method of multiple page layouts, record types, and workflows to update record types is a thing of the past and instead will use Quick Actions & Lightning Components to deliver a more advanced solution.
Create a quick action on the account object. The action type will be ‘Update a Record.’
Assign your fields to the page layout & hit save. You can ignore the message about required fields, it won’t apply to this quick action. Create one quick action for each conditional set of fields you would like to display.
Next, edit or create your custom Account Lightning Page. Drag & drop the Related Record component onto the page, one per each level. Give your component a label like below, select the appropriate Update Action, and lastly, set the component to only be visible when for the corresponding Account Level. Once you have repeated this for each Update Action, save/activate your Lighting Page.
Edit or create a new Lighting Record Page
Add the Related Record lightning component to the page and configure it to use your update actions.
Add your component filters.
The Results: As you change the account level, the conditional components appear, displaying the goals for the current year.
Additional Use Cases:
- Eliminate the need for Account Record Types: If the only reason you want to create a new record type is to display different fields, simplify your build, stick with a -Master- record type, but use conditional components + quick actions to display editable field components based on the Account.
- Display fields to specific users only: Minimize the use of page layouts by profile, instead use the current user’s record to conditionally display fields in a related record component. To understand how to reference the current user, see this post.
- Lock Fields: Create two quick actions with the same fields on it, marking the fields on the page layout for one action as read only, while allowing the others to be edited. You can now display the fields and allow them to be edited based on the record status and then display the read only fields when you would like them to be ‘locked.’ You can prevent annoying users with validation rules and also avoid issues with integration and data uploads that may conflict with validation rules.
- And more: I can come up with a dozen more, but hopefully this is enough to stir your imagination and I would love to see your ideas in the comments below!