Building a Table from User input

I’m currently trying to automate some repetitive processes for my Systems Team by building some dashboards that Hiring Managers can access and then onboard new users by supplying some of their personal information. My current hang is I’m trying to build a validation for group membership in Active Directory by having the user supply a username. My Organization uses Foreign Security Principles through trusted domains so I only have a SID, to begin with, and I have already built scripts that handle the SID to UserID translation. But I’m having issues getting this to work properly with the New-UDTable cmdlet.

Here is a code snippet of my null check if statement after the Input ($NetID is the User Input variable):

Currently, the Error I’m getting says it cannot bind the InputAction content to convert the UDTable value type of System.Management.Automation.ScriptBlock to type UniversalDashboard.Models.Component. From what I could find on the net regarding similar errors it looks as if it’s having issues passing a string to the UDTable. Any help anyone can provide would be greatly appreciated.

Here is a Snip of the Error

@aggiebeckett

Try passing the value of the New-UDTable to the content parameter of New-UDInputAction. It looks like it’s expecting a component rather than a script block. This is inconsistent with the rest of the module and should be fixed.

But try something like this:

$Table = New-UDTable ...
New-UDInputAction -Content $Table
1 Like

@adam

That worked like a charm. Can’t believe I didn’t try that to begin with. Still digesting the UD cmdlet. But I’m getting there.

For future reference as well, in case someone else runs into this issue, one other thing I had to change in order to get it to pass the results properly was to set my Get-ADGroup command as a variable and have the Table return that.

Something like this:

P.S. Adam, thank you for answering my emails and providing me a link to the forums. You have been a big help getting this setup. I appreciate it.

1 Like

I know it have been so long since last reply on this post but i used exactly the same steps however, i am stuck with the same in here with no luck .

Get-UDDashboard | Stop-UDDashboard
$MyDashboard = New-UDDashboard -Title "Employee information" -Content {
	New-UDInput -Title "Information Request" -Id "Form" -Content {
		New-UDInputField -Type 'textbox' -Name 'Username' -Placeholder 'Username'
	} -Endpoint {
		param ($Username)
		
		$table = New-UDTable -Title "" -Headers @("Name", "User Name", "title", "IPphone") -Endpoint {
			Get-ADUser -Identity $Username -Properties displayname, samaccountname, title, IPphone | foreach{
				[PSCustomObject]@{
					Name = $_.displayname
					UserName = $_.Samaccountname
					ArabicName = $_.title
					IPphone = $_.IPphone
				}
			} | Out-UDTableData -Property ("Name", "UserName", "title", "IPphone")
		}
		New-UDInputAction -Content $table
	}
	
}

Start-UDDashboard -Port 80 -Dashboard $MyDashboard

Start-Process http://localhost

i also tried with this one with no luck

Get-UDDashboard |Stop-UDDashboard
$MyDashboard = New-UDDashboard -Title "Service information" -Content {
    New-UDInput -Title "Information Request" -Id "Form" -Content {
            New-UDInputField -Type 'textbox' -Name 'name' -Placeholder 'name'
                } -Endpoint {
            param([string]$name)

            $table = New-UDTable -Title "" -Headers @("status", "Name", "DisplayName") -Endpoint {
            Get-Service $name  |	Out-UDTableData -Property ("status", "Name", "DisplayName")
    }
    New-UDInputAction -Content $table
    }

}

Start-UDDashboard -Port 80 -Dashboard $MyDashboard 

Start-Process http://localhost

How is it not working? Is there an error or something?

No Errors it just do nothing on submit

Can you try enabling logging to see if there is an error?

Enable-UDLogging

Start-Process http://localhost
20:10:16 [Debug] GetDashboardCommand Name:
20:10:16 [Debug] StopDashboardCommand ByServer
20:10:16 [Debug] ThemeService {“name”:“Azure”,“definition”:{“UDGrid”:{“BackgroundColor”:"#252525",“FontColor”:"#FFFFFF"},“UDChart”:{“BackgroundColor”:"#252525","
FontColor":"#FFFFFF"},“UDCounter”:{“BackgroundColor”:"#252525",“FontColor”:"#FFFFFF"},“UDCard”:{“BackgroundColor”:"#252525",“FontColor”:"#FFFFFF"},“UDFooter”:{“B
ackgroundColor”:"#1c1c1c",“FontColor”:"#55b3ff"},“UDInput”:{“BackgroundColor”:"#252525",“FontColor”:"#FFFFFF"},“UDDashboard”:{“BackgroundColor”:"#333333",“FontCo
lor”:"#FFFFF"},“UDTable”:{“BackgroundColor”:"#252525",“FontColor”:"#FFFFFF"},“UDMonitor”:{“BackgroundColor”:"#252525",“FontColor”:"#FFFFFF"},“UDNavBar”:{“Backgro
undColor”:"#1c1c1c",“FontColor”:"#55b3ff"}},“parent”:""}
20:10:17 [Debug] ThemeService {“name”:“Blue”,“definition”:{“UDGrid”:{“BackgroundColor”:"#05608A",“FontColor”:"#FFFFFF"},“UDChart”:{“BackgroundColor”:"#05608A",“F
ontColor”:"#FFFFFF"},“UDCounter”:{“BackgroundColor”:"#252525",“FontColor”:"#FFFFFF"},“UDCard”:{“BackgroundColor”:"#05608A",“FontColor”:"#FFFFFF"},“UDFooter”:{“Ba
ckgroundColor”:"#067DB2",“FontColor”:"#55b3ff"},“UDInput”:{“BackgroundColor”:"#05608A",“FontColor”:"#FFFFFF"},“UDDashboard”:{“BackgroundColor”:"#333333",“FontCol
or”:"#FFFFF"},“UDTable”:{“BackgroundColor”:"#05608A",“FontColor”:"#FFFFFF"},“UDMonitor”:{“BackgroundColor”:"#05608A",“FontColor”:"#FFFFFF"},“UDNavBar”:{“Backgrou
ndColor”:"#067DB2",“FontColor”:"#55b3ff"}},“parent”:""}
20:10:17 [Debug] ThemeService {“name”:“DarkDefault”,“definition”:{“UDGrid”:{“BackgroundColor”:"#272C33",“FontColor”:"#FFFFFF"},“UDChart”:{“BackgroundColor”:"#272
C33",“FontColor”:"#FFFFFF"},“UDCounter”:{“BackgroundColor”:"#272C33",“FontColor”:"#FFFFFF"},“UDCard”:{“BackgroundColor”:"#272C33",“FontColor”:"#FFFFFF"},“UDTable
“:{“BackgroundColor”:”#272C33”,“FontColor”:"#FFFFFF"},“UDInput”:{“BackgroundColor”:"#272C33",“FontColor”:"#FFFFFF"},“UDDashboard”:{“BackgroundColor”:"#393F47",“F
ontColor”:"#FFFFFF"},“UDFooter”:{“BackgroundColor”:"#272C33",“FontColor”:"#FFFFFF"},“UDMonitor”:{“BackgroundColor”:"#272C33",“FontColor”:"#FFFFFF"},“UDNavBar”:{"
BackgroundColor":"#272C33",“FontColor”:"#FFFFFF"}},“parent”:""}
20:10:17 [Debug] ThemeService {“name”:“Default”,“definition”:{“UDFooter”:{“BackgroundColor”:“rgb(36, 81, 131)”,“FontColor”:“rgb(255, 255, 255)”},“UDNavBar”:{“Bac
kgroundColor”:“rgb(36, 81, 131)”,“FontColor”:“rgb(255, 255, 255)”},“UDDashboard”:{“BackgroundColor”:“rgb(255,255,255)”,“FontColor”:“rgb(0, 0, 0)”}},“parent”:""}
20:10:17 [Debug] ThemeService Rendering theme to CSS.
20:10:17 [Debug] ThemeService {“name”:“Azure”,“definition”:{“UDGrid”:{“BackgroundColor”:"#252525",“FontColor”:"#FFFFFF"},“UDChart”:{“BackgroundColor”:"#252525","
FontColor":"#FFFFFF"},“UDCounter”:{“BackgroundColor”:"#252525",“FontColor”:"#FFFFFF"},“UDCard”:{“BackgroundColor”:"#252525",“FontColor”:"#FFFFFF"},“UDFooter”:{“B
ackgroundColor”:"#1c1c1c",“FontColor”:"#55b3ff"},“UDInput”:{“BackgroundColor”:"#252525",“FontColor”:"#FFFFFF"},“UDDashboard”:{“BackgroundColor”:"#333333",“FontCo
lor”:"#FFFFF"},“UDTable”:{“BackgroundColor”:"#252525",“FontColor”:"#FFFFFF"},“UDMonitor”:{“BackgroundColor”:"#252525",“FontColor”:"#FFFFFF"},“UDNavBar”:{“Backgro
undColor”:"#1c1c1c",“FontColor”:"#55b3ff"}},“parent”:""}
20:10:17 [Debug] ThemeService {“name”:“Blue”,“definition”:{“UDGrid”:{“BackgroundColor”:"#05608A",“FontColor”:"#FFFFFF"},“UDChart”:{“BackgroundColor”:"#05608A",“F
ontColor”:"#FFFFFF"},“UDCounter”:{“BackgroundColor”:"#252525",“FontColor”:"#FFFFFF"},“UDCard”:{“BackgroundColor”:"#05608A",“FontColor”:"#FFFFFF"},“UDFooter”:{“Ba
ckgroundColor”:"#067DB2",“FontColor”:"#55b3ff"},“UDInput”:{“BackgroundColor”:"#05608A",“FontColor”:"#FFFFFF"},“UDDashboard”:{“BackgroundColor”:"#333333",“FontCol
or”:"#FFFFF"},“UDTable”:{“BackgroundColor”:"#05608A",“FontColor”:"#FFFFFF"},“UDMonitor”:{“BackgroundColor”:"#05608A",“FontColor”:"#FFFFFF"},“UDNavBar”:{“Backgrou
ndColor”:"#067DB2",“FontColor”:"#55b3ff"}},“parent”:""}
20:10:17 [Debug] ThemeService {“name”:“DarkDefault”,“definition”:{“UDGrid”:{“BackgroundColor”:"#272C33",“FontColor”:"#FFFFFF"},“UDChart”:{“BackgroundColor”:"#272
C33",“FontColor”:"#FFFFFF"},“UDCounter”:{“BackgroundColor”:"#272C33",“FontColor”:"#FFFFFF"},“UDCard”:{“BackgroundColor”:"#272C33",“FontColor”:"#FFFFFF"},“UDTable
“:{“BackgroundColor”:”#272C33”,“FontColor”:"#FFFFFF"},“UDInput”:{“BackgroundColor”:"#272C33",“FontColor”:"#FFFFFF"},“UDDashboard”:{“BackgroundColor”:"#393F47",“F
ontColor”:"#FFFFFF"},“UDFooter”:{“BackgroundColor”:"#272C33",“FontColor”:"#FFFFFF"},“UDMonitor”:{“BackgroundColor”:"#272C33",“FontColor”:"#FFFFFF"},“UDNavBar”:{"
BackgroundColor":"#272C33",“FontColor”:"#FFFFFF"}},“parent”:""}
20:10:17 [Debug] ThemeService {“name”:“Default”,“definition”:{“UDFooter”:{“BackgroundColor”:“rgb(36, 81, 131)”,“FontColor”:“rgb(255, 255, 255)”},“UDNavBar”:{“Bac
kgroundColor”:“rgb(36, 81, 131)”,“FontColor”:“rgb(255, 255, 255)”},“UDDashboard”:{“BackgroundColor”:“rgb(255,255,255)”,“FontColor”:“rgb(0, 0, 0)”}},“parent”:""}
20:10:17 [Debug] ThemeService {“name”:“Earth”,“definition”:{“UDGrid”:{“BackgroundColor”:"#6B4E04",“FontColor”:"#FFFFFF"},“UDChart”:{“BackgroundColor”:"#6B4E04","
FontColor":"#FFFFFF"},“UDCounter”:{“BackgroundColor”:"#6B4E04",“FontColor”:"#FFFFFF"},“UDCard”:{“BackgroundColor”:"#6B4E04",“FontColor”:"#FFFFFF"},“UDFooter”:{“B
ackgroundColor”:"#8A6505",“FontColor”:"#55b3ff"},“UDInput”:{“BackgroundColor”:"#6B4E04",“FontColor”:"#FFFFFF"},“UDDashboard”:{“BackgroundColor”:"#AB7D06",“FontCo
lor”:"#FFFFF"},“UDTable”:{“BackgroundColor”:"#6B4E04",“FontColor”:"#FFFFFF"},“UDMonitor”:{“BackgroundColor”:"#6B4E04",“FontColor”:"#FFFFFF"},“UDNavBar”:{“Backgro
undColor”:"#8A6505",“FontColor”:"#55b3ff"}},“parent”:""}
20:10:17 [Debug] ThemeService {“name”:“Green”,“definition”:{“UDGrid”:{“BackgroundColor”:"#70B24B",“FontColor”:"#000000"},“UDChart”:{“BackgroundColor”:"#70B24B","
FontColor":"#000000"},“UDCounter”:{“BackgroundColor”:"#70B24B",“FontColor”:"#000000"},“UDCard”:{“BackgroundColor”:"#70B24B",“FontColor”:"#000000"},“UDFooter”:{“B
ackgroundColor”:"#72C220",“FontColor”:"#000000"},“UDInput”:{“BackgroundColor”:"#70B24B",“FontColor”:"#000000"},“UDDashboard”:{“BackgroundColor”:"#628C3C",“FontCo
lor”:"#000000"},“UDTable”:{“BackgroundColor”:"#70B24B",“FontColor”:"#000000"},“UDMonitor”:{“BackgroundColor”:"#70B24B",“FontColor”:"#000000"},“UDNavBar”:{“Backgr
oundColor”:"#72C220",“FontColor”:"#000000"}},“parent”:""}
20:10:17 [Debug] ThemeService {“name”:“Red”,“definition”:{“UDGrid”:{“BackgroundColor”:"#A1220C",“FontColor”:"#FFFFFF"},“UDChart”:{“BackgroundColor”:"#A1220C",“Fo
ntColor”:"#FFFFFF"},“UDCounter”:{“BackgroundColor”:"#A1220C",“FontColor”:"#FFFFFF"},“UDCard”:{“BackgroundColor”:"#A1220C",“FontColor”:"#FFFFFF"},“UDFooter”:{“Bac
kgroundColor”:"#C2290F",“FontColor”:"#55b3ff"},“UDInput”:{“BackgroundColor”:"#A1220C",“FontColor”:"#FFFFFF"},“UDDashboard”:{“BackgroundColor”:"#333333",“FontColo
r”:"#FFFFF"},“UDTable”:{“BackgroundColor”:"#A1220C",“FontColor”:"#FFFFFF"},“UDMonitor”:{“BackgroundColor”:"#A1220C",“FontColor”:"#FFFFFF"},“UDNavBar”:{“Backgroun
dColor”:"#C2290F",“FontColor”:"#55b3ff"}},“parent”:""}
20:10:17 [Debug] ThemeService {“name”:“Test”,“definition”:{“UDDashboard”:{“BackgroundColor”:"#234234",“FontColor”:"#959595"}},“parent”:""}
20:10:17 [Debug] ThemeService Rendered theme content: .ud-footer {
background-color : rgb(36, 81, 131);
color : rgb(255, 255, 255);
}
.ud-navbar {
background-color : rgb(36, 81, 131);
color : rgb(255, 255, 255);
}
.ud-dashboard {
background-color : rgb(255,255,255);
color : rgb(0, 0, 0);
}

20:10:17 [Debug] EndpointService Register() Form
20:10:17 [Debug] EndpointService Unregister() Form
20:10:17 [Debug] EndpointService Endpoint found. Removing endpoint.
20:10:17 [Debug] NewInputFieldCommand {“required”:false,“type”:“textbox”,“dotNetType”:null,“validOptions”:null,“placeholder”:[“name”],“name”:“name”,“value”:null,
“links”:null,“okText”:“Ok”,“cancelText”:“Cancel”,“clearText”:“Clear”,“validationEndpoint”:null,“validationErrorMessage”:null}
20:10:17 [Debug] NewInputCommand {“type”:“input”,“title”:“Information Request”,“submitText”:“Submit”,“fields”:[{“required”:false,“type”:“textbox”,“dotNetType”:nu
ll,“validOptions”:null,“placeholder”:[“name”],“name”:“name”,“value”:null,“links”:null,“okText”:“Ok”,“cancelText”:“Cancel”,“clearText”:“Clear”,“validationEndpoint
“:null,“validationErrorMessage”:null}],“backgroundColor”:null,“fontColor”:null,“validate”:false,“id”:“Form”,“refreshInterval”:0,“autoRefresh”:false,“hasCallback”
:true}
20:10:17 [Debug] NewDashboardCommand {“id”:“00000000-0000-0000-0000-000000000000”,“title”:“Service information”,“navBarColor”:null,“navBarFontColor”:null,“backgr
oundColor”:null,“fontColor”:null,“navbarLinks”:null,“scripts”:null,“stylesheets”:null,“pages”:[{“type”:“page”,“name”:“home”,“url”:null,“defaultHomePage”:false,“i
con”:null,“components”:[{“type”:“input”,“title”:“Information Request”,“submitText”:“Submit”,“fields”:[{“required”:false,“type”:“textbox”,“dotNetType”:null,“valid
Options”:null,“placeholder”:[“name”],“name”:“name”,“value”:null,“links”:null,“okText”:“Ok”,“cancelText”:“Cancel”,“clearText”:“Clear”,“validationEndpoint”:null,“v
alidationErrorMessage”:null}],“backgroundColor”:null,“fontColor”:null,“validate”:false,“id”:“Form”,“refreshInterval”:0,“autoRefresh”:false,“hasCallback”:true}],”
dynamic”:false,“title”:null,“id”:null,“refreshInterval”:0,“autoRefresh”:false,“hasCallback”:false}],“cyclePages”:false,“cyclePagesInterval”:10,“error”:null,“foot
er”:null,“navBarLogo”:null,“Demo”:false,“geolocation”:false,“filterText”:null,“navigation”:null,“frameworkAssetId”:“index.98605f71459d2aab680d.bundle.js”}
20:10:17 [Info] StartDashboardCommand - - False
20:10:17 [Debug] StartDashboardCommand {“id”:“00000000-0000-0000-0000-000000000000”,“title”:“Service information”,“navBarColor”:null,“navBarFontColor”:null,“back
groundColor”:null,“fontColor”:null,“navbarLinks”:null,“scripts”:null,“stylesheets”:null,“pages”:[{“type”:“page”,“name”:“home”,“url”:null,“defaultHomePage”:false,
“icon”:null,“components”:[{“type”:“input”,“title”:“Information Request”,“submitText”:“Submit”,“fields”:[{“required”:false,“type”:“textbox”,“dotNetType”:null,“val
idOptions”:null,“placeholder”:[“name”],“name”:“name”,“value”:null,“links”:null,“okText”:“Ok”,“cancelText”:“Cancel”,“clearText”:“Clear”,“validationEndpoint”:null,
“validationErrorMessage”:null}],“backgroundColor”:null,“fontColor”:null,“validate”:false,“id”:“Form”,“refreshInterval”:0,“autoRefresh”:false,“hasCallback”:true}]
,“dynamic”:false,“title”:null,“id”:null,“refreshInterval”:0,“autoRefresh”:false,“hasCallback”:false}],“cyclePages”:false,“cyclePagesInterval”:10,“error”:null,“fo
oter”:null,“navBarLogo”:null,“Demo”:false,“geolocation”:false,“filterText”:null,“navigation”:null,“frameworkAssetId”:“index.98605f71459d2aab680d.bundle.js”}
20:10:17 [Debug] CustomAssemblyLoadContext Pointer Size:8
20:10:17 [Debug] CustomAssemblyLoadContext Loading files in native directory: C:\Program Files\WindowsPowerShell\Modules\UniversalDashboard.Community\2.5.2\net47
2\runtimes\win-x64\native
20:10:17 [Debug] CustomAssemblyLoadContext Loading file: C:\Program Files\WindowsPowerShell\Modules\UniversalDashboard.Community\2.5.2\net472\runtimes\win-x64\na
tive\libuv.dll
20:10:17 [Debug] CustomAssemblyLoadContext Loading file: C:\Program Files\WindowsPowerShell\Modules\UniversalDashboard.Community\2.5.2\net472\runtimes\win-x64\na
tive\Microsoft.DiaSymReader.Native.amd64.dll
20:10:17 [Debug] ExecutionService ExecutionService constructor