Autocomplete list search trough two objects?

I have autocomplete and it working well it shows things in the dropdown when I write.
But the “thing” that it search trough has two objects inside it and it can only show one of them in the dropdown and you can only search for one of them.

For example; I have two objects Name and Code then if I start writing the numbers the dropdown from the textbox should show the code as that’s that it matches to but if I start writing the name it should start showing the name in the dropdown.
Is this possible?

Or maybe show both.

So here is one example so it make more sense, it has worked before. If you did search on the “human” name it showed the matching samaccountname, aslo if you did search for the email it started to show the right username for that email/upn. @Adam do you know why it stopped working? I did get the bug report from a user that it stopped working for a long time ago so I don’t know from which version it did stop working.

 New-UDAutocomplete -id "txtVDIUser" -Icon (New-UDIcon -Icon 'User') -Label "Användare (Namn-, användarnamn UPN eller E-post) *" -OnLoadOptions {
                                If ($Body.length -ge 3) {
                                    $SelectedUser = Get-ADObject -LDAPFilter "(&(objectCategory=user)(anr=$Body))" -Properties SamAccountName
                                    $SelectedUser | Select-Object -ExpandProperty SamAccountName | ConvertTo-Json

Solved it

                            New-UDAutocomplete -Id 'txtTest' -Icon (New-UDIcon -Icon 'Sticky_note') -Label "Write something" -Value $Session:NewComputerInfoStep.Test-FullWidth -OnLoadOptions { 
                                If ($Body.length -ge 3) {
                                    $TestValue = $CacheTest | Where-Object -FilterScript { ($_.displayname -like "*$Body*") -or ($_.code -like "*$Body*") }
                                    $TestValue | ForEach-Object { Add-Member -InputObject $_ -NotePropertyName "ShowValue" -NotePropertyValue "$($_.displayname), $($_.code)" -Force }
                                    $TestValue | Select-Object -ExpandProperty ShowValue | ConvertTo-Json
                            } -OnChange {
                                if ($null -ne $Body) {
                                    $Session:NewComputerInfoStep.Test = ((Get-UDElement -Id "txtTest").value).Split(", ")[-1]
                                    Sync-UDElement -Id "TestShowValue"