filterPickerStatic.html
<template>
<lightning-card
title="RecordPicker Static"
class="slds-card__body_inner"
icon-name="standard:search"
>
<div>
<lightning-record-picker
lwc:ref="recordPicker"
object-api-name="Contact"
placeholder="Search..."
label="Select a record"
matching-info={matchingInfo}
display-info={displayInfo}
filter={filter}
onchange={handleChange}
>
</lightning-record-picker>
</div>
</lightning-card>
</template>
filterPickerStatic.js
import { LightningElement } from 'lwc';
export default class LightningRecordPickerStatic extends LightningElement {
selectedRecordId = '';
matchingInfo = {
primaryField: { fieldPath: "Name" },
additionalFields: [{ fieldPath: "Title" }],
};
displayInfo = {
additionalFields: ["Title"],
};
filter = {
criteria: [
{
fieldPath: "Account.Name",
operator: "like",
value: "Edge%",
},
],
};
handleChangePrimary(event) {
this.selectedRecordId = event.detail.recordId;
console.log("Primary 🚀 ~ this.selectedRecordId:", this.selectedRecordId);
}
handleChangeAdditional(event) {
this.selectedRecordId = event.detail.recordId;
console.log("Additional 🚀 ~ this.selectedRecordId:", this.selectedRecordId);
}
}