Skip to content

Instantly share code, notes, and snippets.

@janegilring
Created November 16, 2017 19:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save janegilring/05f916b9852616125030938f94b0f5e4 to your computer and use it in GitHub Desktop.
Save janegilring/05f916b9852616125030938f94b0f5e4 to your computer and use it in GitHub Desktop.
Example dashboard for taking input and performing actions - built with PowerShell Universal Dashboard (https://poshtools.com/powershell-universal-dashboard)
#requires -Modules UniversalDashboard
$Colors = @{
BackgroundColor = "#FF252525"
FontColor = "#FFFFFFFF"
}
Start-UDDashboard -Content {
New-UDDashboard -Title "Employee registration form" -NavBarColor '#FF1c1c1c' -NavBarFontColor "#FF55b3ff" -BackgroundColor "#FF333333" -FontColor "#FF55b3ff" -Pages @(
New-UDPage -Url "/register/:id" -Endpoint {
param($id)
New-UDInput -Title "Register employee number" -Endpoint {
param($EmployeeNumber)
$WebHookUri = 'https://s2events.azure-automation.net/webhooks?token=abc123' # Replace with actual token
$Date = (Get-Date -Format "MM/dd/yyyy HH:mm:ss").ToString()
$headers = @{"From"=$($env:username);"Date"=$Date}
$parameters = @{
IFSEmployeeId = $EmployeeNumber
SharepointListItemId = $id
}
$body = ConvertTo-Json -InputObject $parameters
$response = Invoke-RestMethod -Method Post -Uri $WebHookUri -Headers $headers -Body $body
New-UDInputAction -Toast "Thank you for registering employee number $EmployeeNumber"
}
}
)
} -Wait
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment