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?
Discussion posts and replies are publicly visible
I tried to mimic this scenarioInterface -
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 ) )
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 ) ) )
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:
Once the new country i am trying to add then i receive "picker field label length error".
Have you tried the above code as-is to understand how it works? Are you getting an issue with my exact code?
I understand your code.I try to map with record type to save the new value or saved one value.then in picker field the first alphabet is only visible.For example, add "xyz" and once select then "x" is visible.Not sure why this is happening.