I’m trying to create a form that will update a list of dropdown lists depending on what is selected in the first dropdown. I currently have it trying to check what the first dropdown, however I’m still really new to Universal Dashboard and only just getting used to Endpoints and the like
This is what I have so far. If anyone has done something similar, or knows what direction I should be looking in that would be fantastic (Please excuse me if the formatting isn’t correct, first time posting any kind of code)(Also please excuse the obfuscated array terms, just staying safe)
$DivisionArray = @('Financial Control','People & Marketing')
$FinanceArray = @('Financial Control Department 1',
'Financial Control Department 2',
'Financial Control Department 3')
$MarketingArray = @('People & Marketing' Department 1',
'People & Marketing' Department 2',
'People & Marketing' Department 3',
'People & Marketing' Department 4')
$Dashboard = New-UDDashboard -Title 'New Staff Member' -Content {
New-UDInput -Title 'New User Information' -Content {
New-UDInputField -Type textbox -Name "UDFullName" -PlaceHolder "Full Name"
New-UDInputField -Type textbox -Name "UDPreferredName" -PlaceHolder "Preferred Name"
New-UDInputField -Type textbox -Name "UDStaffNo" -PlaceHolder "Staff Number"
New-UDInputField -Type select -Name "UDDivision" -PlaceHolder "Division" -Values $DivisionArray
If($UDDivision -eq 'Financial Control')
{
New-UDInputField -Type select -Name "UDDepartment" -PlaceHolder "Department" -Values $FinanceArray
}
If($UDDivision -eq 'People & Marketing')
{
New-UDInputField -Type select -Name "UDDepartment" -PlaceHolder "Department" -Values $MarketingArray
}
New-UDInputField -Type select -Name "UDManager" -PlaceHolder "Manager" -Values $FinanceManagerArray
} -Endpoint {
param(
$UDFullName, $UDPreferredName, $UDStaffNo, $UDDivision, $UDDepartment, $UDManager
)
$script:NewStaff = [PSCustomObject]@{
FullName = $UDFullName
PreferredName = $UDPreferredName
StaffNo = $UDStaffNo
Department = $UDDepartment
Division = $UDDivision
Manager = $UDManager
}
}
}