New-UDTextBox not updating when setting the ID parameter

Product: PowerShell Universal
Version: 4.2.8

Hey guys and gals,

Pretty new to this PSU stuff, and I’m having a little issue that I can’t seem to solve!

Here’s my code that works:

Set-UDElement 'tree' -content {
                    Get-ADOrganizationalUnit -Filter * -Server -Searchbase 'OU=OUName,DC=my,DC=domain,DC=com,DC=au' -SearchScope 1 -Properties canonicalname,distinguishedname | select name,canonicalname,distinguishedname | sort name | ForEach-Object {
                        New-UDTreeView -Id 'selectOU' -Node { New-UDTreeNode -Name $_.Name -Id $_.DistinguishedName } -OnNodeClicked {
                            Get-ADorganizationalUnit -Filter * -Searchbase $ -SearchScope 1 -properties canonicalname,distinguishedname | select canonicalname, distinguishedname,name | ForEach {
                            New-UDTreeNode -Name "$($_.Name)" -Id "$($_.distinguishedname)" -Leaf:$(-not $_.distinguishedname)
                        $Global:Value = $
                        Set-UDElement 'SelectedOU' -Content {
                            New-UDTextbox -Value $Value -Label "Selected OU" -FullWidth -Icon 'folder'
                        Show-UDToast $Global:Value

With this code, the Toast and the Text Box shows the OU selected, even if it’s a child OU.

However, if I add the following to the New-UDTextBox it will only EVER show the parent OU in the text box and stored in the value, but will show the child OU selected in the Toast:

 Set-UDElement 'SelectedOU' -Content {
                            New-UDTextbox -Value $Value -Label "Selected OU" -FullWidth -Icon 'folder' -id 'wheretoput'

Literally just putting an ID parameter on the text box stops it from showing what I need it to. Is this a bug?

If I don’t add the ID parameter, it labels the field as a random GUID and I can’t use that parameter to pass to the script that runs after the information has been collected.

Hopefully all of this makes sense!



Looks like a similar problem to these

There is something about having an ID on something inside of a dynamicic region that breaks the update functionality

Yeah, looks like that’s the issue - I’m wondering that as it’s been around for a while why it hasn’t been fixed.

@Adam - can you confirm this seems to be a bug and whether it’s being looked at?

Looks like there is an issue open on the git repository

As a workaround, you can store the dynamically generated ID in a variable and reference that