2

I am trying out the new lightning-record-picker component and I see that you can only get the record id of the item selected. Is there any easy way to capture the values from other fields?

Upon looking at the this post I am feeling that I have to use a wire adaptor and use the getRecord method to get the other field values.

<lightning-record-picker label="Parts Family" object-api-name="Product2" matching-info={matchingInfo}
                display-info={displayInfo} filter={filter} onchange={handleChange}></lightning-record-picker>

Here is how I capture the record Id in JS.

handleChange(event) {
        console.log(event.detail);
        this.isPartSelected = event.detail.recordId != null ? true : false
        console.log("isPartSelected -", this.isPartSelected);
    }

1 Answer 1

2

lightning-record-picker is meant to operate like a picklist of records. That's why you only get the record Id. You are definitely expected to use another method (e.g. getRecord) to obtain any additional data you want from the record.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .