Today, I'm excited to share a custom Lightning Web Component (LWC) designed to elevate the functionality of the standard Lightning Record Picker. This custom component not only supports an additional field for search but also allows a custom description field in the dropdown while searching records in Salesforce.
Key Features of the Custom Flow Record Picker
This enhanced component extends the capabilities of the traditional Lightning Record Picker by introducing the following features:
Advanced Matching Fields:
-
primarySearchField
: Override the primary matching field to enable searches based on fields other than the standard name field (Supports Formula field). -
additionalSearchField
: Introduce an additional matching field, allowing for searches that consider both primary and secondary field values (Supports Formula field).
Custom Display Fields:
-
primaryDisplayField
: Override the primary display field to tailor the primary information shown in the dropdown (Supports Formula field). -
additionalDisplayField
: Add an additional display field, giving users a more comprehensive view of each record (Supports Formula field).
Custom Filter For Records:
-
filter
: Filter retrieved records with JSONed filter format.
Create flow with Advanced Flow Record Picker
- Create a screen flow or edit an existing screen flow.
- Add a new flow screen or edit the existing one to add the Flow Record Picker.
-
Search for Flow Record Picker in the components tab and select the
RGForce Flow Record Picker.
- Select configure the component properties:
- Object API Name
- Primary Search Field
- Label
- Additional Search Field - to enable search with an additional field
- Primary Display Field
- Additional Display Field
- Save and Activate the flow, now the Flow Record picker is ready to use.
Download Source Code
Download Lightning Flow Record Picker Code
Example Flow
Download Flow Record Picker Code example flow definition meta xml
Record Picker additional features:
Supports all standard props:
- disabled - disable component if true.
- field-level-help - tooltip message.
- filter - filter criteria JSON GraphQL style.
- label - label of the input.
- message-when-bad-input - custom message when the user selects bad input.
- object-api-name - API name of the object to look for.
- placeholder - placeholder when no value is selected.
- required - make the value required.
- value - selected record id.
- variant - Lightning Record Picker variant - standard, label-hidden, label-inline.
@api
) Record Picker functions:
- blur() - focus the input.
- checkValidity() - check if the input value is valid.
- clearSelection() - clear the selected record.
- focus() - focus the input.
- reportValidity() - validate the input value.
- setCustomValidity() - set custom validity message.
No comments :
Post a Comment
Hi there, comments on this site are moderated, you might need to wait until your comment is published. Spam and promotions will be deleted. Sorry for the inconvenience but we have moderated the comments for the safety of this website users. If you have any concern, or if you are not able to comment for some reason, email us at rahul@forcetrails.com