Product: PowerShell Universal
Version: 4.0.8
Hi,
I tried to use the example in New-UDStepper to create a flow for setting the expiration date for consultant users.
Stepper - PowerShell Universal
But instead of have a New-UDTextbox with the -value parameter, i want to use a New-UDTable and New-UDDatePicker instead.
New-UDApp -Title 'PowerShell Universal' -Content {
New-UDStepper -Steps {
New-UDStep -OnLoad {
New-UDGrid -Container -Content {
New-UDGrid -ExtraSmallSize 5 -Content {
New-UDCard -Content {
$UsersToSelectFrom = Get-Aduser -filter "SamAccountName -like 'cons_*'" -Properties DisplayName,AccountExpirationDate
$Columns = @(
New-UDTableColumn -Property UserPrincipalName -Hidden
New-UDTableColumn -Property SamAccountName -Title "Initials" -ShowSort -ShowFilter -DefaultSortColumn
New-UDTableColumn -Property DisplayName -Title "Display Name" -ShowSort -ShowFilter
New-UDTableColumn -Property AccountExpirationDate -Title "Expiration Date" -ShowSort
New-UDTableColumn -Property Enabled -Title "Enabled" -ShowSort
New-UDTableColumn -Property SelectedADObject -Render {
New-UDButton -Text "Select" -OnClick {
Show-UDToast $EventData.SamAccountName
Set-UDElement -Id 'SelectedConsUser' -Content {$EventData.SamAccountName}
} -ShowLoading
}
)
New-UDTable -Columns $Columns -Data $UsersToSelectFrom -ShowSort -ShowFilter -ShowPagination -PageSize 8 -Dense -DisablePageSizeAll
#New-UDTextbox -Id 'txtStep1' -Value $EventData.Context.txtStep1
}
}
}
} -Label "Select user"
New-UDStep -OnLoad {
New-UDGrid -Container -Content {
New-UDGrid -ExtraSmallSize 5 -Content {
New-UDCard -Content {
New-UDDatePicker -OnChange {
Show-UDToast -Message $body
}
}
}
}
New-UDTextbox -Id 'txtStep2' -Value $EventData.Context.txtStep2
} -Label "Select new expiration data"
} -OnFinish {
New-UDTypography -Text 'Nice! You did it!' -Variant h3
New-UDElement -Tag 'div' -Id 'result' -Content {
$(Get-UDElement -Id 'SelectedConsUser').Value | Out-File C:\Temp\SelectedConsUser.txt
$f = $body | ConvertFrom-Json
$f.context | Out-File C:\Temp\StepBody.txt
}
}
}
How do i save the value from the steps (SamAccountName and the date) for use in the final block?