New-UDAutocomplete issue with onchange

May be using this completely wrong.

Im hoping to have a user select a single email from the autocomplete box, and once selected, run a query using the $Body (which hopefully is just a string of the email) which the $currentzoomperms variable is then set to. Once that’s done, I try to sync a table that’s using the variable $currentzoomperms.

I added the Show-UDToast for bug checking but it appears to be empty, anything apparent that I’m doing wrong?

New-UDAutocomplete -OnLoadOptions { $mailboxes.WindowsEmailAddress | Where-Object { $_ -like "*$Body*" } | ConvertTo-Json

} -OnChange {

    Show-UDToast $Body 

    $currentzoomperms = Get-ZoomUserSchedulers $Body | select -ExpandProperty schedulers | Sort-Object email

    Sync-UDElement -Id 'current_perms'

    Show-UDToast $currentzoomperms 

}

I tried this with a static list of options and seems to work.

    New-UDPage -Id 'variables' -Name "Name" -Content {
New-UDAutocomplete -OnLoadOptions { "address", "address2" | Where-Object { $_ -like "*$Body*" } | ConvertTo-Json

} -OnChange {

    Show-UDToast $Body 

}

Any chance WindowsEmailAddress isn’t a string?

The autocomplete is working, its more the onchange / table update that isnt.

I think the bigger issue is that I cant get this table to update for some reason.


New-UDCard -Content {

New-UDDynamic -Id 'table' -Content {

    $currentzoomperms = (Get-ZoomUserSchedulers [user email] | select -ExpandProperty schedulers | Sort-Object email)

    New-UDTable -Data $currentzoomperms -Columns $columns2

} 

}

New-UDButton -Text 'Message Box' -OnClick {

    Sync-UDElement -Id 'table'

}

New-UDButton -Text 'Message Box2' -OnClick {

    $currentzoomperms = (Get-ZoomUserSchedulers [useremail2] | select -ExpandProperty schedulers | Sort-Object email)

    Show-UDToast -Message "$($currentzoomperms[0].email | Out-string)"

}

The table successfully populates with the information on page load. When I click button2, I can verify that the $currentzoomperms object is being updated because it toasts with the updated info. Pressing Button1 does not refresh the table though.