Created
November 16, 2017 19:53
-
-
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)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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