[SalesForce] Selecting Fields on a related record component of lightning Page

How to select the fields that are visible on a Related Record component on a lightning page ?

I've been through this article.

My end users need different set of fields to be visible on a Related Record component of a Lightning Page for each record type on cases. How can I assign different Related Record components to different case pagelayouts/Lightning Page ?

On cases there are 5 different case record types
and for each record type they want different fields to be seen on the Related Record component of the case lightning Page.

How to implement this?

Best Answer

You can do this by creating Update Quick Actions for each Record Type, and then adding 5 Related Record components to the page, each using a different Quick Action for the fields, and then filter visibility for each component based on the Record Type.

Start by creating the Quick Actions: Setup > Object Manager > Case > Buttons, Links and Actions. Create a new Action of type Update a Record. I recommend using a Label like "RR - [RT Name]", eg, "RR - Product Support" to keep track. On the layout editor, select the fields you want to display for that record type. Repeat for each Record Type.

In Lightning App Builder, open your Case Record Page. Add a Related Record Component. Choose the relevant Lookup field, and then choose the Update Action for one of the record types. Then, under Set Component Visibility, click Add Filter, then Advanced for Filter Type. Click Select field, choose Record, and then navigate to Case Record Type > Record Type Name. (Or, if you're wanting to filter for the Record Type of the related record, navigate through the appropriate lookup relationship, and then to the Case Record Type and RT Name field). Put the Developer Name (usually has underscores instead of spaces) in the Value of the filter, leaving Equal as the Operator:

Screenshot of Component Visibility filter

Add four more Related Components, each one under the last, so you end up with 5 stacked on top of each other. Set the Quick Action and Component Visibility for each of the Record Types. Save everything, and users will only see the Related Record component corresponding to the correct Record Type when they look at the record page.