Skip to main content
Besuchen Sie uns auf der TDX in San Francisco oder bei Salesforce+ vom 5. bis 6. März, um die Entwicklerkonferenz für die Ära der AI-Agenten zu erleben. Jetzt registrieren.

Geschätzte Zeit

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.

Praktische Aufgabe

+500 Punkte

Machen Sie sich bereit

Sie führen diese(n/s) Lektion in Ihrer eigenen, persönlichen Übungs-Organisationen durch. Klicken Sie auf Launch (Starten), um loszulegen, oder auf den Namen Ihrer Organisation, um eine andere auszuwählen.

Ihre Aufgabe

Review updates to Salesforce to maintain your JavaScript Developer I Certification.
Implement and configure a lightning-record-picker component.

If you haven’t already completed unit 2, do that now. Otherwise, you won't be able to complete this challenge.
  • Update the boatPicker component
    • Configure the picker to display boat name as the main field and type as an additional field.
    • Configure the picker to search boat name as the main field and type as an additional field.
    • Configure the picker to change which boat is displayed when the selected record is changed.
  • To ensure the component is working as expected, deploy the boatPicker to the homepage of the Lightning Service application.
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"