Lightning Field Set Record Display Component

Lately I’ve been on a Lightning component R&D kick focusing on building flexible, generic prototype components. My most recent work was building a readonly Record Display that’s configurable through a specified Field Set.

If you like what you see, try it out from my Lightning Prototypes Unmanaged Package.

Overview

The record display shows a one column display of fields from a given record using the lightning:outputField and lightning:recordViewForm components. One can declaratively use it on any record home page, specify the field set to use, and then it’ll show the fields the given user has access to. #ClicksNotCode!

Configuration

  1. Create a field set on the object with the desired fields to display. Note: This can only be done in Classic at this time.
  2. Using the Lightning App Builder, add this to the desired record home page(s) and then enter the API name of the field set in the component’s “Field Set Name” attribute.

Benefits

  • Gives additional flexibility over the fields to display than a page layout.
  • Field Level Security. If the user doesn’t have access to a field, it’s not shown and visible fields after it are still shown unlike the lightning:inputField in my Field Set Form V2 lightning component.
  • Can have multiple on a record display for various use cases as needed.
  • Minimal coding. Only some Apex is needed to get the field info from the field set. The recordViewForm and outputField components take care of querying the record and its fields and displaying the appropriate values.

Limitations

  • Prototype. Doesn’t have full styling, editing capabilities, and other expected features.
  • One-Column Layout. Doesn’t support other layout types.

Future R&D

  • More layout support. Would like to add multi-column support and possibly multi-section support too. Thought of seeing if the new UI API could be used here.
  • Configuration through page layouts using the UI API for more expressive UI possibilities.
  • Adding editing support.

What did you think of it?

Leave a Reply

Your email address will not be published. Required fields are marked *