Product: PowerShell Universal
Version: 1.5.15
I am making a page using New-UDForm that will let our helpdesk move user accounts between OU’s. As part of this I have it display text showing the current location and where they want to move it to before starting the move. I can’t seem to get it to update the text when clicking the “Get User” button
Here is where I get the username and sync the UDElement for the UDDynamic
New-UDColumn -Id "col_Input" -SmallSize 6 -LargeSize 6 -Content {
New-UDTextbox -id 'tb_OldUsername' -Label "Username to change"
New-Udhtml -markup "<br>"
New-UDButton -Id "btn_GetUser" -Text "Get User" -OnClick {
$samaccountname = (Get-UDElement -Id 'tb_OldUsername').value
$session:user = get-aduser -filter {samaccountname -eq $samaccountname} -properties homedirectory
if ($session:user){
Set-UDElement -id "dd_type" -Properties @{disabled = $false}
$Session:CurrentLocation = ($session:user | select-object -ExpandProperty distinguishedname).split(",",2)[1]
Sync-UDElement -id 'Initial_User'
}
else{
Set-UDElement -id "dd_type" -Properties @{disabled = $true}
}
}
##### More stuff here#########
}
And here is the UDDynamic
New-UDColumn -SmallSize 6 -LargeSize 6 -Id "col_DataCheck" -Content {
New-UDDynamic -id 'Initial_User' -Content {
New-UDTypography -id "txt_oldUsername" -text "Moving User: $($session:user.name)"
new-udhtml -markup "<br>"
New-UDTypography -id "txt_oldHomedir" -text "Current Home Directory: $($session:user.HomeDirectory)"
new-udhtml -markup "<br>"
New-UDTypography -id "txt_oldlocation" -text "Current Location: $($Session:CurrentLocation)"
}
}
The text shows on page load, but when clicking the button it will not refresh with the variable information. I’ve tried with and without $session: for each variable and none of them update.
I’ve tested showing the data using a Modal on button press and it does get generated, it just won’t sync to the typography.