Record Picker
Overview
The Avonni Record Picker component is a pre-built UI element for the Salesforce Dynamic Components App. It allows users to search . This component is ideal for forms, workflows, or interfaces requiring quick record selection.
Use Cases
Case Form: Select a related Account or Contact for case assignment.
Opportunity Page: Pick a parent Account or Campaign for context.
Custom Object Form: Choose linked records (e.g., Project Manager for a Project__c).
Service Workflow: Assign technicians or assets from searchable lists.
Event Management: Select venues or sponsors from custom objects.
Data Entry: Streamline record linking in Dynamic Component forms.
Configuration
Basic Properties
These control core functionality and labeling.
API Name
Text
Unique identifier for the instance.
RecordPicker
Label
Text
Label displayed for the input.
"Select Contact"
Object API Name
String
API name of the Salesforce object to query (e.g., Account, Contact, Custom_Object__c).
Contact
Value
Binding
Stores the selected record’s ID (accessible via $Component.RecordPicker.Value).
Bind to variable for use
Field Level Help
Text (Optional)
Help text shown next to the label for guidance.
"Search for a contact."
Variant
Select
Label style: standard (above), label-inline (beside), label-hidden, label-stacked (animates up).
standard
Placeholder
Text
Hint text when field is empty.
"Type to search..."
Required
Boolean
Mandates a selection; use with form validation.
On
Disabled
Boolean
Prevents interaction with the component.
Off
Display Info Section
These configure the suggestion display.
Primary Field
String
Field shown first in suggestions (defaults to Name field).
Name
Additional Field
Array (String)
Single extra field for suggestions (array with one field API name).
["Email"]
Search Info Section
These control search behavior.
Mode
Select
Search matching: Contains (matches anywhere), Starts With (matches start).
Contains
Primary Field
String
Main field for search queries (Text or Formula-Text only).
Name
Additional Field
String
One extra field for search queries (Text or Formula-Text only).
Email
Tip: Set the Mode to 'Contains' for flexible searches; use Primary/Additional Fields to focus on relevant data. (Placeholder for screenshot: Record Picker with suggestions.)
Interactions Tab
Define actions on record selection.
On Change
Settings
Trigger on selection: Use $Component.RecordPicker.Value (record ID) for actions (e.g., Update Record, Navigate, Show Toast).
Examples
This example configures the Avonni Record Picker component in the Dynamic Components app to display a list of Contacts with full name and email on a Lightning page, to the selected Contact’s record page using the component’s generated value.
Add the Record Picker to a Lightning Page:
In the Dynamic Components Builder, drag the Avonni Record Picker component onto a Lightning page (e.g., a Contact List View page).
Why this? Places the Record Picker on the page where users can interact with it, such as a custom Lightning app or record page.
Configure Record Picker:
In the Properties Panel, configure:
API Name: ContactSelector
Label: "Select Contact"
Object API Name: Contact
Placeholder: "Search Contacts..."
Primary Field: Name (displays the full name)
Additional Field: ["Email"] (shows the email alongside the name)
Mode: Contains
Why this? The Record Picker displays a searchable list of Contacts on the Lightning page, showing their full name and email, with the selected ID available via $Component.ContactSelector.Value.
Set Interaction:
In the Interactions Tab of the Record Picker, configure:
On Record Select:
Add a Navigate action:
Target: Navigate to the Contact record page using /{$Component.ContactSelector.Value} (the component’s generated value for the selected record ID).
Why this? The "On Record Select" event triggers when a Contact is chosen, navigating to the corresponding record page. The $Component.ContactSelector.Value attribute returns the record ID (e.g., 003xxxxxxxxxxxx) of the selected item, enabling the correct redirection without needing a separate variable.
Note: The $Component.ContactSelector.Value attribute on the Record Picker component dynamically returns the record ID of the selected item, which is used directly in the navigation URL.
Result: Users search and select a Contact on the Lightning page, and the interaction navigates to the selected Contact’s record page using the ID from $Component.ContactSelector.Value.
Key Considerations
Object Selection: Ensure Object API Name matches a valid Salesforce object with searchable fields.
Search Fields: Use Text or Formula-Text fields for Primary/Additional Field to avoid errors.
Dynamic Bindings: Bind Value to a variable for use in flows or updates; use {!Record.FieldApiName} for context-aware headers on Record Pages.
Required Fields: Combine Required with form validation to enforce selections.
Performance: Test with large datasets; limit search fields for speed.
Accessibility: Ensure clear Labels/Placeholders; test keyboard navigation for suggestions.
Troubleshooting Common Issues
No Suggestions Shown: Verify Object API Name and search fields; check user permissions.
Search Not Working: Confirm Mode and Primary/Additional Field are Text-based; test with sample terms.
Value Not Captured: Ensure Value is bound to a variable; check interaction setup.
UI Issues: Adjust Variant for space; test Placeholder visibility on mobile.
Required Not Enforced: Add validation logic in Flow; ensure Required is On.
Slow Performance: Limit search fields; optimize object queries.
Summary
The Avonni Record Picker component streamlines record selection in Salesforce Dynamic Components, with flexible search and display options. It’s perfect for forms and workflows requiring quick lookups.
Last updated
Was this helpful?
