I have a function that fetches data, and places it in an autocomplete, but the value parameter of New-UDAutocompleteOption doesnt seem to accept json data.
Bump. Anyone have any idea what this could be? Updated to 5.0.9 and no difference. (And noticed I wrote one of the code blocks wrong above… $_.Computername should of course be $_.Status
Thank you so much for the suggestion, but I am already doing this (not putting the parameters in a hashtable, but string interpolation, "$()").
I also tried putting the result in a variable but the result is exactly the same. This doesnt work, but adding anything to the $value string that breaks the json format makes it work.
This may seem irrelevant, but can you try bypassing the pipeline and directly passing the InputObject? I’m wondering if it’s having an issue with the evaluation.
Another thing to try, though it won’t work in the structure you’re anticipating, is to transform your prefilled JSON string into a traditional pscustomobject/hashtable to see if it may be an issue with the evaluation on ConvertFrom-Json… this is an interesting one. Let me know if either of those have any effect; I’m going to test this on an app in my environment in the meantime to see if I can’t recreate.
Well, converting your $EventData to JSON works for the UDToast - but for whatever reason, something with the -OnChange trigger is causing this. You could also access the Value with $EventData.Value, predictably.
Bypassing the pipeline, ConvertTo-Json -Compress -InputObject $_, does nothing. Same error.
Also tried the ConvertTo-JsonEX from the Universal module, but no difference.
Using tha original hashtable works, but like mentioned, the value isn’t what I need in the end. Show-UDToast Is really just a part of an entire script, so I would prefer to have the JSON string.
It is only an issue with New-UDAutocomplete though. Using New-UDSelect works just as expected.