Parameters for the cx-picker Fragment

This topic lists the parameters that you can set for the cx-picker fragment. To learn how to set parameters for this fragment, see Configure the Picker.

Required Parameters for the cx-picker Fragment

Parameter

Sample Value

Description

dynamicLayoutContext

[[ $dynamicLayoutContext ]]

This parameter is set by default and you don't have to change it if the field displays on a create or edit page.

If this field doesn't display on a create or edit page, but rather on a mass update page for example, then you can remove the default value in this parameter.

pickerLayoutId

PickerLayout

This parameter points to the rule set whose layout controls how the picker looks at runtime.

The default value, which you don't have to change, is PickerLayout, the ID of the Picker Layout rule set that's predefined for each object including custom objects.

If you need to create a custom rule set, then create the rule set as a dynamic table and ensure that the values for the Label and ID fields are identical. Then add the rule set's ID to this parameter.

resource

[[ {"name": "accounts","displayField":"OrganizationName","endpoint":"cx-custom","primaryKey":"PartyId" } ]]

Use this parameter to pass the target object name and end point:

  • name - target object name

  • endpoint - target object end point

Optionally pass these additional attributes:

  • displayField - the field value that's displayed in the picker field after the user makes a selection. If not provided here, then the picker displays the first field in the picker layout, by default.

  • primaryKey - the field to derive the primaryKey from. If not provided, then the object's primaryKey field will be used.

Be sure to update the resource parameter with the appropriate values for your use case. For example, replace accounts with the REST API name of the object that the dynamic choice list field is based on.

Optional Parameters for the cx-picker Fragment

Parameter

Sample Value

Description

context

To display one field vs. another, set the context parameter to [[ {'variableName':true} ]].

For example: [[ {'showContact':false} ]]

To allow users to enter text values into this field, add this property to the context parameter: [[ {'enablePlainText':true} ]]

You can use the context parameter to control picker behavior. For example:

  • Display different fields in a picker at runtime.

    For example, based on the value of this parameter, the picker could display either Field A or Field B.

    To set this up, see Display Different Fields in a Picker.

  • Allow the user to enter a text value into the field at runtime, instead of selecting an existing value.

createConfig

[[ {'enabled':true} ]]

Indicates if the user can create a record directly from the picker. Specify true or false.

If no value is set, then the "create a record" option is automatically displayed in the picker by default.

isDefaultSavedSearchEnabled

This parameter is a check box.

Use this parameter to indicate the default saved search that's automatically applied to the list of values in the picker field.

The check box is not selected, by default.

  • When not selected, the Default Search View option is automatically selected from the list of saved searches on the picker field.

    For accounts and contacts, the default search view is All Accounts and All Contacts.

  • When selected, the default selection is always the default saved search enabled for the object, regardless of the last saved search selected.

Note: This parameter is applicable only for objects that are supported by Adaptive Search.

label

US Account

Use this parameter to override the field name on the UI.

This parameter is particularly useful if a filter is defined on the dynamic choice list field in Application Composer or if you pass filter criteria using the query parameter (described below).

For example, if you add a simple filter to the dynamic choice list field to display only accounts in the US, then you can use the label parameter to change the field name. In this example, you might want to change the Account field name to a new field name, US Account.

pickerNameField

{{ $value.pickerNameField }}

Use this parameter in conjunction with the context parameter to support user-entered text in the picker field. Bind this parameter to a virtual field that you create, such as pickerNamefield.

If this field has a simple filter (from Application Composer) or a value in the query parameter, then any value in the pickerNameField parameter is ignored.

query

[{"op":"$co","attribute":"OrganizationName","value":"Pinnacle"}]

Use this parameter to filter the records that are available in the picker at runtime.

For example, you could filter the records to display only accounts with a specific keyword in the name, such as Pinnacle.

The value for this parameter should be an array[object].

If you have both a simple filter on the dynamic choice list field (from Application Composer) and also a query in this parameter, then this parameter takes precedence.

If you pass a value in this parameter, then the list of saved searches won't display in the picker at runtime.

readonly

This parameter is a check box.

Use this parameter to make the field read only.

For example, you might want to make the field editable only when users first create a record. During edit, however, you might want this field to be read only.

required

This parameter is a check box.

This parameter is applicable only when there is no value in the dynamicLayoutContext parameter. Use this parameter to make the picker field required.

If the dynamicLayoutContext parameter does contain a value, however, then you can make the picker field required by selecting the Required check box on the Fields tab. For example: Payment_c tab > Fields subtab > select the Account_Id_c field > on the Properties pane, click the Required check box.

selectedRow

{{ $page.variables.selectedRow }}

Use this parameter in conjunction with the value parameter to make use of other field values from the selected row in the picker.

For example, if the user picks a contact, then the contactId is stored in the value parameter that's bound to the picker. But, the user can also retrieve the contact's email address using this parameter.

sortCriteria

For example, [[ [{'attribute': 'PrimaryContact.PartyName', 'direction': 'descending'}] ]]

Use this parameter to override the default sort criteria in the picker layout.

If the user selects a saved search, then the sort criteria comes from this parameter, if provided. If not provided, then the picker honors the sort criteria defined in the saved search. If not defined, then the picker sorts values based on the first column in the picker layout.

If there is a simple filter on the field or if a filter is defined in the query parameter, or if the user selects Related Records, then the sort criteria comes from this parameter, if provided. If not provided, then the picker sorts values based on the first column in the picker layout.

value

{{ $page.variables.pickerValue }}

Use this parameter to store the value selected in the picker field, when there is no value in the dynamicLayoutContext parameter.

For example, let's say a contact picker is on a page doesn't have a dynamic layout.

If the user picks a contact, then the contactId is stored in the value parameter that's bound to the picker.