Skip to main content
Skip table of contents

sfdc-record-picker

A logic element that, when evaluated, becomes a HTML structure that allows users to search for Salesforce records and then either select one of them, or bring values of their fields into the Form.

Search filters

To help the users with their searches, a set of filters may be defined that the users can customize to limit the results. The filter-fields attribute takes a comma-separated list of field API names that then each produce a filter input for the search view, eg. "Type__c, IsSpecial__c" to produce two filters based on these custom fields. The kind of input that appears depends on the field's value type, eg. checkbox filters allow a true or false selection, while picklist filters appear as selection components displaying the picklist's values. Each filter then limits the search to only find records that have the field set to the value selected by the user. Should the fields to be used as filters be a dependent picklist and the field that picklist depends on, ie. its "controller", their dependency rules take effect in these filter inputs, preventing the user from selecting value combinations that go against the rules.  

Each filter, except those based on date or dateTime -type fields, may also be given a default value. The filter input will then start out being set into this value. A default value for a filter is defined by adding it to the field name in the filter-fields value, with a colon separating the name and the value, eg. "Status__c:Done, Language__c:Finnish". The default value may be ignored if it cannot be interpreted as a value suited for the field, or in the case of dependent picklists, is not allowed due to dependency rules.

Drag & drop content

If the content-field attribute is defined, the record picker can be used as a source of easily accessible content. Dragging and dropping one of the search result rows into an editable area on the Form causes the value of the corresponding record's field, specified by content-field, to appear on the drop location. Users can also preview a record's field value by pressing the icon on the right side of the search result row.

Attributes

name

Required

Value type

EL-evaluated

No

String

Yes

Defines the name of the variable that will hold the Id of the selected record.

object

Required

Value type

EL-evaluated

Yes

String

Yes

Defines the object type whose records the record picker component searches for. The expected value is the API name of the object.

content-field

Required

Value type

EL-evaluated

No

String

Yes

Defines the name of the field whose content is brought into an editable area when one of the found records is dragged into it. The expected value is the API name of one of the fields of the object whose records are being searched.

filter-fields

Required

Value type

EL-evaluated

No

String

Yes

Defines the fields that may be used for filtering while searching for records. Expected value is a comma-separated list of field names and, optionally, the filters' default values - see the "Search filters" documentation above.

title-field

Required

Value type

EL-evaluated

No

String

Yes

Defines the field whose value will be displayed representing a record in the search results. The expected value is the API name of one of the fields of the object whose records are being searched.

If not defined, the object's "name field", as defined by Salesforce, is selected automatically.

order-by-field

Required

Value type

EL-evaluated

No

String

Yes

Defines the field which will be used to sort the search results. The expected value is the API name of one of the fields of the object whose records are being searched.

The order-by-ascending attribute can be used to control whether the sorting is ascending or descending.

If not defined, the search results will be presented in an undefined order.

order-by-ascending

Required

Value type

EL-evaluated

No

Boolean

Yes

Defines if search results are sorted in an ascending (resolved value of true) or descending (resolved value of false) order.

This attribute won't have any effect if order-by-field is not defined.

If not defined, the search results are shown in ascending order.

recent-tab-label

Required

Value type

EL-evaluated

No

String

Yes

Defines the label of the tab displaying recently accessed records.

If not defined, the tab will not be displayed at all.

search-tab-label

Required

Value type

EL-evaluated

No

String

Yes

Defines the label of the tab displaying the record search.

If not defined, the label is set to "Search Records".

Examples

The record picker's drag & drop functionality can be put to good use with a collection of records with content that you'd like to display on documents - like predefined text blocks. Setting up the record picker for this purpose doesn't require much configuration:

CODE
<dyn-sfdc-record-picker name='selectedRecord' object='Clause__c' content-field='Clause_Text__c' filter-fields='Language__c:${userLanguage}'/>

This example record picker would allow users to search Clause records and bring the values of their Clause Text fields into an editable area. The search of this picker has a Language filter input, which can be assumed to be a picklist displaying the languages that these Clauses can be in. This filter will be initially set to the option representing the language of the active user.

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.