Skip to main content
Unisciti a noi al TDX, a San Francisco o su Salesforce+, il 5-6 marzo per la conferenza degli sviluppatori sull'era degli Agenti IA. Registrati ora.

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.

Sfida pratica

+500 punti

Preparati

Completerai questa unità, questo progetto o questa fase nella tua organizzazione di prova. Fai clic su Avvia per iniziare o seleziona il nome della tua organizzazione per sceglierne un'altra.

La tua sfida

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.
Condividi il tuo feedback su Trailhead dalla Guida di Salesforce.

Conoscere la tua esperienza su Trailhead è importante per noi. Ora puoi accedere al modulo per l'invio di feedback in qualsiasi momento dal sito della Guida di Salesforce.

Scopri di più Continua a condividere il tuo feedback