- 04 Nov 2023
- 3 Minutes to read
- Print
- DarkLight
Configure header-level search bar
- Updated on 04 Nov 2023
- 3 Minutes to read
- Print
- DarkLight
Configure a search bar to enable comprehensive search of Deal Manager lines. Once configured, a search bar appears at the top of the Add Lines, Line Items, and Workspace lists, just beneath the header of each. Users first select from a pre-defined set of columns to search against, and then enter the string they want to search for in the selected column.
You can configure specific fields to appear in the dropdown picklist. The search itself is a "Starts with" or "Contains" comparison.
Prerequisites
Before configuring this feature, make sure that the following fields are visible and can be edited:
- Search Bar Workspace Configuration on Workspace Configuration object.
- Search Bar Line Items Configuration on Product Selector Configuration object.
- Search Bar AddLines Configuration on Product Selector Configuration object.
- Search Bar Configuration object:
- sObjectName
- Default Displayed Search Field
- Type of Search
- Search Field object:
- Search Bar Configuration
- Column Label
- Type
- Field Name of Column (for SOQL query)
If the fields are not visible or can't be edited, confirm they have been added to the object's page layout and are visible in the user's profile. For detailed instructions on how to add fields and check for visibility, refer to Make fields visible or editable.
Define Search Bar Configuration records
In this procedure, you will define Search Bar Configuration records, then link them to Add Lines, Line Items and Workspace components. You can assign the same search bar configuration to Line Items and Workspace.
- From the App Launcher, search for Search Bar Configurations, then select New.
- In the New Search Bar Configuration dialog, enter or select values:
Search Bar Configuration Name—Specify a descriptive name for the configuration.
Type of Search—Specify the type of search operator this configuration will use (such as Contains or Starts with).
TipContains is the default Type of Search in every new Search Bar Configuration you define. Alternatively, you can define Starts with as the default. Users cannot change the search type being used by a search bar.
sObject Name—Specify the API name of the object for this configuration (header’s Line Item object for Line Items/Workspace components or Product2 object for Add Lines).
Default Displayed Search Field—Select one of the Search Fields that you will create later, to be used as the default.
- Select Save.
- Go to the Search Bar Configurations > Related > Search Fields, then select New.
- In the New Search Field dialog, enter or select values:
- Name—Specify the name of the search field.
- Column Label—Specify a user-friendly label that will appear in rendered search bar.
- Field Name of Column (for SOQL query)—Specify the API name of a Text field from the sObject you defined in Search Bar Configuration.
- Type—Select Text field.
- Select Save.
- Repeat these steps for each field you want to search against.
Add Search Bar Configurations to the components
- From the Lightning App Launcher, go to the Product Selector Configuration object.
- On the Details tab, set Search Bar configurations in the following fields:
- Search Bar Line Items Configuration—Select a configuration value for the Line Items component.
- Search Bar Add Lines Configuration—Select a configuration value for the Add Lines component.
- Search Bar Workspace Configuration—Select a configuration value for the Workspace component.
Configure translation for the timeout error message
You can optionally configure a translation for the timeout message that is displayed to the user if the search doesn't return the results within the set time limit.
- Configure Translation Workbench:
- Go to Setup > Translation Language Settings.
- In Translation Workbench, in the Supported Languages section, select Add to add the languages your organization supports.
- Configure the translation for the timeout error message:
- Go to Setup > Custom Labels > and select the TimeoutErrorMessage label.
- In the Local Translations / Overrides section, select New Local Translations / Overrides.
- In the New Translation dialog:
- From the Language dropdown, select the language you added in Step 1b.
- In the Translation text field, type the translation for the timeout error message.
- Select Save.
Users will be able to see the translated text if they have set the appropriate language in their profile. Go to Profile > Settings > Language & Time Zone > and from the Language dropdown, select the desired language.