I do this quite often - it's a little tedious, but I like the results it gives me.
I use a TextInput and set the default value to varSelectedUser and the reset value to varResetInput
[TextInput1]
Default:
varSelectedUser
Reset:
varResetInput
I then use a ListBox which I position under the input and I set a couple of values;
[ListBox1]
OnSelect:
Update the varSelectedUser value to what was selected
Reset the InputText control to put varSelectedUser in there (toggle varResetInput true to false)
UpdateContext({varSelectedUser: ListBox1.Selected.DisplayName});
UpdateContext({varResetInput: true});
UpdateContext({varResetInput: false})Items:
If the textbox has more than 3 characters in it, search Office365Users by what's typed into the textbox and limit the results by 10.
If(Len(TextInput1.Text)>3, Office365Users.SearchUser({searchTerm:TextInput1.Text, top:10}))Set the Fields value under the Items input to "Display Name" or whatever user info you want to appear in the list box as a result of the search.
Visible:
FALSE if TextInput has less than 4 characters in it
FALSE if the name typed in equals varSelectedUser
FALSE if the value selected in the ListBox is equal to varSelectedUser
otherwise TRUE
If(Len(TextInput1.Text)<4, false,
If(TextInput1.Text = ListBox1.Selected.DisplayName, false,
If(TextInput1.Text=varSelectedUser, false, true)))
I'm sure someone can find a more elegant way of crafting this IF statement, perhaps even using Switch or the builtin Switch for IF - but I prefer stating each IF for readability 🙂
I *think* that's about it
Hope this helps,
RT