Skip to main content
Build the future with Agentforce at TDX in San Francisco or on Salesforce+ on March 5–6. Register now.

Get Hands-on with Lightning-Record-Picker

Learning Objectives

After completing this unit, you’ll be able to:

  • Implement and configure the lightning-record-picker.
  • Search for records with the lightning-record-picker component.

The lightning-record-picker component allows users to quickly find and select Salesforce records. You learn how to configure the component’s behavior and presentation, plus enable filtering so that users can retrieve and display the records they want. For the hands-on challenge, you use the component in a playground org to provide an additional way for customers to search inventory.

Search for Records with the Lightning-Record-Picker Component

Use the lightning-record-picker component in a Salesforce application so that desktop and mobile users can quickly find and select Salesforce records. Configure the component’s behavior and presentation, and enable filtering so that users can retrieve and display precisely the records that they want. This feature, now generally available, includes some changes since the previous release. You can now retrieve up to 100 records whereas previously, it was 50 records. The component also displays clear error messages when you configure invalid specifications and supports new attributes. This component uses the GraphQL wire adapter, which enables offline use.

Where: This feature is available for Lightning Experience in all editions.

How: Here’s an example to get started with the lightning-record-picker component. The component attributes provide the label for the input field, the object to search, and a callback to handle the selection of a record.

<lightning-record-picker
    label="Select a record"
    placeholder="Search..."
    object-api-name="Contact"
    value={initialValue}
    onchange={handleChange}
></lightning-record-picker>

Here’s what the example looks like in the UI.

UI implementation of the code.

Providing a record ID to thevalue attribute makes the record picker component display a default selected record.

UI displays the value for the record ID as Michael Jones.

In this unit, you learned how the lightning-record-picker allows users to find and select records and how you can tailor the component’s behavior and presentation. Now, you apply your knowledge of the lightning-record-picker component in a practical case involving a customer search in your boat inventory.

Teilen Sie Ihr Trailhead-Feedback über die Salesforce-Hilfe.

Wir würden uns sehr freuen, von Ihren Erfahrungen mit Trailhead zu hören: Sie können jetzt jederzeit über die Salesforce-Hilfe auf das neue Feedback-Formular zugreifen.

Weitere Infos Weiter zu "Feedback teilen"