Picklist component (Deprecated)
Picklist component (Deprecated)
|
|
Deprecated
This feature is still available, but no longer supported as of the April 2020 release of Coveo for Salesforce version 4.2. |
This component adds a drop down menu to a case creation form.
Options
title
Specifies the title to display above the drop down menu.
<div data-title='<YOUR_TITLE>'></div>
Where you replace <YOUR_TITLE> by the title you want to display above the drop down menu.
caseField
Specifies the field used to save the drop down menu value when the user submits the form.
<div data-case-field='<YOUR_FIELD>'></div>
Where you replace <YOUR_FIELD> by the name of the field you want to use to save the drop down menu.
values
Specifies the values available in the drop down menu.
If this option is left empty, they’re automatically obtained using the caseField option.
<div data-values="Low, Medium, High"></div>
defaultValue
Specifies the default selected value in the drop down menu.
<div data-default-value="<DEFAULT_VALUE>"></div>
Where you replace <DEFAULT_VALUE> by the value you want to be displayed by default (for example, Low).
toolTip
Specifies what to display when the user’s mouse is over the title.
<div data-tooltip='<TOOLTIP>'></div>
Where you replace <TOOLTIP> by the message you want to be displayed when the user’s mouse is over the title (for example, Low).
isRequired
Specifies whether an option has to be selected before the form can be submitted.
The default value is false.
<div data-is-required='false'></div>
enableSearch
Specifies whether to include the selected option keywords in the search for related cases.
The default value is false.
|
|
Note
If |
addQre
Specifies whether to add a QRE in the query using the searchField and the selected option as expression.
The default value is true.
This option is useful only when enableSearch is set to true.
<div data-add-Qre='true'></div>>
The generated expression looks like this, where:
-
searchFieldis thesearchFieldoption (see searchField) -
selectedOptionis the option selected by the user -
queryModiferis thequeryModifieroption (see queryModifier)
|
|
The value needs to be in the values option. Otherwise, the picklist value is set to an empty string. |
$qre(expression: searchField=selectedOption, modifier: queryModifier)
|
|
Note
For more information on how this expression work, see $qre. |
searchField
Specifies the field to use in the QRE added to the search query.
This option is useful only when addQre is enabled.
<div data-search-field="@<YOUR_FIELD>"></div>
Where you replace <YOUR_FIELD> by the name of the field you want to use in the QRE added to the search query.
queryModifier
Specifies how to affect the ranking score for items where the searchField is equal to the selected option (see $qre).
The default value is 50.
This option is used with searchField to boost item by adding a query ranking expression (QRE) where the searchField is equal to the selected option.
This option is useful only when addQre is enabled.
<div data-query-modifier='50'></div>
enableAnalytic
Specifies whether to enable analytics on the component.
The default value is true.
<div data-enable-analytic='true'></div>
Methods
getQueryExpression
Gets the expression that’s added to the query.
$('#myPicklist').coveo('getQueryExpression')
searchIsValid
Returns true if search is enabled and the value isn’t empty, else it returns false.
$('#myPicklist').coveo('searchIsValid')
setValid
Marks the field as valid.
$('#myPicklist').coveo('isValid')
setInvalid
Marks the field as invalid, preventing the user from creating a case using the submit button.
The field becomes valid if the field changes, the cancel button is clicked, or the setValid method is called.
$('#myField').coveo('setInvalid')
isValid
When isRequired is enabled, returns whether the user selected a value.
$('#myPicklist').coveo('isValid')
getValue
Gets the picklist selected value.
$('#myPicklist').coveo('getValue')
setValue
Sets the value of the picklist, with the following parameters:
-
value: The value to set, as a string. -
triggerChange: (Optional) Whether to trigger a query. The default value istrue
$('#myPicklist').coveo('setValue', value, triggerChange?: boolean = true)
The following method changes the picklist to my value and triggers a new query.
$('#myPicklist').coveo('setValue', 'my value', true)
|
|
The value needs to be in the values option. Otherwise, the picklist value is set to an empty string. |
Usage
<div class="CoveoPicklist"></div>