PU 1.4.5 - Table

I am trying filter users by search from AD and get buttons tor form in the table but not working. What am I missing.


New-UDForm -Content {

                    New-UDTextbox -Placeholder 'Identity' -Id 'txtIdentity'

                } -OnSubmit {

                    $Input = ConvertFrom-Json $Body

                    $CominedUser = "*$($Input.txtIdentity)*"

                    New-UDTable -Title 'Active Directory' -LoadData {

                    $TableData = ConvertFrom-Json $Body

                    $UserObject = Get-ADUser -Filter {name -like $CominedUser} -Server $Server -Credential $Credential -Properties * -ErrorAction Stop | ForEach-Object{

                        @{

                            Name = $_.Name

                            Username = $_.SamAccountName

                        }

                        

                    }

                    $UserObject | Out-UDTableData -page $TableData.page -TotalCount $UserObject.Count -Property $TableData.Properties

                }-Columns @(

                    New-Udtablecolumn -Property 'Name'

                    New-udtableColumn -Property 'UserName'

                    New-udtableColumn -property 'UserName' -Title 'More Info' -Render {

                        New-UDButton -Id "btn$($EventData.Name)" -Text "Click Now" -OnClick{

                        }

                    }

Hey try this.

New-UDForm -content {
New-UDTextbox -Placeholder ‘Identity’ -Id ‘txtIdentity’
} -OnSubmit {
$Input = ConvertFrom-Json $Body
CominedUser = "*($Input.txtIdentity)*"
$UserObject = Get-ADUser -Filter {name -like $CominedUser} -Server $Server -Credential $Credential -Properties * -ErrorAction Stop | select name,SamAccountName
ADColumns = @( New-UDTableColumn -Property name -Title "Name" New-UDTableColumn -Property SamAccountName -Title "User Name" New-UDTableColumn -Property MoreInfo -Title 'More Info' -Render { New-UDButton -Id "btn($Item.SessionKey)" -Text “Click Now” -OnClick {

		}
	}
)
New-UDTable -Data $UserObject -columns $ADColumns

}

1 Like

Thanks SnV. I was able to get it working.

NP, you fixed it your self or from the above?

1 Like

Your code.

Glad I could help.