I have a grid display with a Status button. I want to pass a CertificateID ($_.CertificateID
in the code below) to a form that pops up in a modal window. I have a $CertificateID parameter defined in the New-UDInput endpoint to receive the variable. Haven’t been able to figure out how pass it from the grid to the modal form.
New-UDPage -Name "Certificate List" -Icon list -Content {
$CertificateListColumns = @('CertificateID', 'Subject', 'Thumbprint', 'NotBefore', 'NotAfter')
$CertificateListHeaders = @('CertificateID', 'Subject', 'Thumbprint', 'Start Date', 'Expire Date')
New-UDColumn -Size 12 {
$newUDGridSplat = @{
FontColor = 'White'
Title = "Certificate List"
Headers = $CertificateListHeaders
PageSize = 20
Properties = $CertificateListColumns
BackgroundColor = 'Black'
Endpoint = {
$Data | ForEach-Object {
[PSCustomObject]@{
CertificateID = $_.CertificateID
Subject = $_.Subject
Thumbprint = $_.Thumbprint
NotBefore = New-UDElement -Tag 'div' -Content { Get-Date($_.NotBefore) -f 'yyyy/MM/dd HH:mm' }
NotAfter = New-UDElement -Tag 'div' -Content { Get-Date($_.NotAfter) -f 'yyyy/MM/dd HH:mm' }
Status = New-UDButton -Text "+" -OnClick {
Show-UDModal -Content {
New-UDRow {
New-UDColumn -Size 6 {
New-UDInput -Title "Certificate - Status Update" -BackgroundColor black -FontColor cyan -Id "CertFileEntryForm" -Content {
New-UDInputField -Type 'select' -Name 'Status' -Placeholder 'Status' -Values @("--Select One--", "Requires Review", "Renewed")
New-UDInputField -Type 'textarea' -Name 'Notes' -Placeholder 'Notes'
} -Endpoint {
param(
$CertificateID,
$Status,
$Notes
)
New-UDInputAction -Content (
New-UDCard -Id 'CertStatusFormResults' -Content {
New-UDParagraph -Text "CertificateID = $CertificateID"
New-UDParagraph -Text "Status = $Status"
New-UDParagraph -Text "Notes = $Notes"
}
)
}
}
}
}
}
}
} | Out-UDGridData
}
}
New-UDGrid @newUDGridSplat
}
}