Custom Picker selection incorrectly populating field

Certified Associate Developer

Hello,

I'm working with a custom picker that should allow one selection. A different selection should be made by removing the first selection. 

Currently, when a user types, makes a selection, and then keeps typing, the input is filled with 50 seemingly random selections. These selections do not save. 

When typing slower and allowing the dropdown to fully load, it works as wanted. Any ideas on how to fix this? Thank you

 a!pickerFieldCustom(
                label: "Name",
                labelPosition: "ABOVE",
                placeholder: "--- Select a Name ---",
                saveInto: local!selectedPerson,
                suggestFunction: rule!AST_GETNAMES,
                selectedLabels: if(
                  a!isNullOrEmpty(local!selectedPerson), 
                  null, 
                  index(rule!AST_GETUSERFROMARRAY(suggestionText:local!selectedPerson), "data")
                ),
                value: if(
                  a!isNullOrEmpty(local!selectedPerson), 
                  null, 
                  index(rule!AST_GETUSERFROMARRAY(suggestionText:local!selectedPerson), "data")
                ),
                required: true,
                validations: {},
                disabled: false,
                maxSelections: 1, /* Only allow one name to be selected at a time */
              ),

  Discussion posts and replies are publicly visible

Parents Reply Children
  • 0
    Certified Senior Developer
    in reply to Kylie

    Hi  ,

    In the Picker Field, you have called the rule ---> index(rule!AST_GETUSERFROMARRAY(suggestionText:local!selectedPerson), "data")  in SelectedLabels And Values. This is the reason why you are getting 50 values (which is in batch size of your pagingInfo)

    Give the same local variable in VALUE parameter as you have given in SAVEINTO parameter and in SelectedLabel try to add logic for how your selection value should be displayed.

    • selectedLabels -- what the user sees 
    • value - the underlying data/id associated with the selected options to store in the database

    Please refer the link for how to configure Custom Picker Field