I have a custom picker field that returns a list of users,
I want to be able to prevent the user from selecting the same user more than once.
Scenario:
Users: "John", "James","Sally"
User comes in and selects "John" as a user on the picker field, then presses "j" the only user that should display is "James". How can I achieve this?
Discussion posts and replies are publicly visible
May be following code works for you :
load( a!formLayout( firstColumnContents: { a!pickerFieldCustom( label: "Select User", suggestFunction: rule!TEST_pickerSuggestFn( searchText: _, selectedUsers: ri!selectedUsers ), selectedLabels: ri!selectedUsers, value: ri!selectedUsers, saveInto: ri!selectedUsers ) } ))
selectedUsers - User (List)
rule!TEST_pickerSuggestFn
with( local!users: { touser( "John" ), touser( "James" ), touser( "Sally" ) }, local!userData: fn!difference( local!users, ri!selectedUsers ), local!matches: where( apply( search( ri!searchText, _ ), local!userData ) ), a!dataSubset( data: index( local!userData, local!matches ), identifiers: index( local!userData, local!matches ) ))
searchText - Text