Skip to main content
March 9, 2026
Question

New value add to custom picker field

  • March 9, 2026
  • 7 replies
  • 0 views

Hi Everyone,

I want to add new value using custom picker field .
Let's say , I have picker field name country and its having all country but not "XYZ".
So how can we add it?

7 replies

shubhama926776
March 9, 2026

I tried to mimic this scenario

Interface -

a!localVariables(
  local!countries: { "USA", "India", "Canada" },
  local!selected: null,
  a!pickerFieldCustom(
    label: "Country",
    suggestFunction: rule!POC_CountrySuggest(
      filter: _,
      labels: local!countries,
      identifiers: local!countries
    ),
    value: local!selected,
    saveInto: local!selected,
    selectedLabels: local!selected
  )
)


Suggestion Function - 
a!localVariables(
  local!matches: where(search(ri!filter, ri!labels)),
  if(
    length(local!matches) > 0,
    a!dataSubset(
      data: index(ri!labels, local!matches),
      identifiers: index(ri!identifiers, local!matches)
    ),
    a!dataSubset(
      data: ri!filter,
      identifiers: ri!filter
    )
  )
)

March 10, 2026

Once the new country i am trying to add then i receive "picker field label length error".

shubhama926776
March 10, 2026

Have you tried the above code as-is to understand how it works?
Are you getting an issue with my exact code?

swathim0002
March 9, 2026

Just adding another version on top of Shubham Version, so that it gives clear understanding to the user that new value is being added. You can modify the values in the saveInto of the pickerfield based on your requirement.

PickerField:

a!localVariables(
  local!matches: where(
    a!forEach(
      items: ri!labels, 
      expression: search( ri!filter, fv!item)
    )
  ),
  a!dataSubset(
    data:  if(
      and(
        contains(
          trim(lower(ri!identifiers)),
          trim(lower(ri!filter))
        )
      ),
      index( ri!identifiers, local!matches),
      append(
        touniformstring(
          index(
            { ri!identifiers },
            local!matches,
            {}
          )
        ),
        ri!filter & " (Add new)"
      )
    ),
    identifiers: if(
      and(
        contains(
          trim(lower(ri!identifiers)),
          trim(lower(ri!filter))
        )
      ),
      index( ri!identifiers, local!matches),
      append(
        touniformstring(
          index(
            { ri!identifiers },
            local!matches,
            {}
          )
        ),
        ri!filter
      )
    )
  )
)

UI Preview:

stefanhelzle0001
March 13, 2026

Find a solution in my blog post.

appian.rocks/.../