--- title: Picklist component (Deprecated) slug: '1258' canonical_url: https://docs.coveo.com/en/1258/ collection: coveo-for-salesforce source_format: adoc --- # 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](https://docs.coveo.com/en/3236#april-2020-release-v4-2-initial-release). This component adds a drop down menu to a case creation form. ## Options ### `title` Specifies the title to display above the drop down menu. ```xml
``` Where you replace `` 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. ```xml
``` Where you replace `` 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. ```xml
``` ### `defaultValue` Specifies the default selected value in the drop down menu. ```xml
``` Where you replace `` 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`. ```xml
``` Where you replace `` 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`. ```xml
``` ### `enableSearch` Specifies whether to include the selected option keywords in the search for related cases. The default value is `false`. > **Note** > > If `addQre`, `addSome`, and `addCorrelateUsingIdf` are all set to `false`, `useSomeOnAllKeywords` on the [CaseCreation component](https://docs.coveo.com/en/1071/) needs to be enabled for this option to be useful. ### `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`. ```xml
> ``` The generated expression looks like this, where: * `searchField` is the `searchField` option (see [searchField](https://docs.coveo.com/en/1258#searchfield)) * `selectedOption` is the option selected by the user * `queryModifer` is the `queryModifier` option (see [queryModifier](https://docs.coveo.com/en/1258#querymodifier)) > **Important** > > The value needs to be in the values option. > Otherwise, the picklist value is set to an empty string. ```xml $qre(expression: searchField=selectedOption, modifier: queryModifier) ``` > **Note** > > For more information on how this expression work, see [$qre](https://docs.coveo.com/en/1462#qre). ### `searchField` Specifies the field to use in the QRE added to the search query. This option is useful only when `addQre` is enabled. ```xml
``` Where you replace `` 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](https://docs.coveo.com/en/1462#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. ```xml
``` ### `enableAnalytic` Specifies whether to enable analytics on the component. The default value is `true`. ```xml
``` ## Methods ### `getQueryExpression` Gets the expression that's added to the query. ```xml $('#myPicklist').coveo('getQueryExpression') ``` ### `searchIsValid` Returns `true` if search is enabled and the value isn't empty, else it returns `false`. ```xml $('#myPicklist').coveo('searchIsValid') ``` ### `setValid` Marks the field as valid. ```xml $('#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. ```xml $('#myField').coveo('setInvalid') ``` ### `isValid` When [isRequired](https://docs.coveo.com/en/1258#isrequired) is enabled, returns whether the user selected a value. ```xml $('#myPicklist').coveo('isValid') ``` ### `getValue` Gets the picklist selected value. ```xml $('#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 is `true` ```xml $('#myPicklist').coveo('setValue', value, triggerChange?: boolean = true) ``` **Example** The following method changes the picklist to `my value` and triggers a new query. ```xml $('#myPicklist').coveo('setValue', 'my value', true) ``` > **Important** > > The value needs to be in the values option. > Otherwise, the picklist value is set to an empty string. ## Usage ```xml
```