Skip to content

Create a dynamically filled Dropdown List in WebJEA

Matthias Petereit edited this page Jul 4, 2023 · 1 revision

In this example we prefilled the Listbox "FPITLB020" (Visible Name is AD-Gruppe) with all ActiveDirectory Groups inside the Domain.

image

First we need to create a Variable

[Parameter ( Mandatory = $true, HelpMessage = "Geben Sie unten den Namen einer Active Directory-Gruppe ein und klicken Sie dann auf Submit." )] [ValidateNotNullOrEmpty()] [string]$FPITLB020,

image

The Important thing is the Variable Name: For a dynamicly filled DropDown Liat it needs to start with "FPITLB"

With this Info, WebJEA knows that its special custom Field that gets the Info from somewhere else and not from the ValidateSet Parameter.

The next thing we need is a File named "FPIT_Commands.ps1" inside the WebJEA-Scriptfolder.

image


Quick Explaination of the contend:

$EXEC_Code

This Variable contains the Name of the Variable we just created in the validate.ps1 Script. "FPITLB020"

$EXEC_Value

Contains the Default Value of the Variable if we set one in the validate.ps1 Script


If the Variable from the validate.ps1 Script would be "FPITLB001" then he would select the first IF Block, compare the Default value and send the corresponding Value back to WebJEA to fill the DropDownList.

If the Variable Name is "FPITLB020" then he creates an array, executes the Powershell command to read all AD-Groups, writes it back in a string and sends it back to WebJEA to fill the DropDownList. The Output needs to be seperated by a semicolon ";" (The last Semicolon in the Output will be removed in WebJEA)


[Console]::OutputEncoding = [System.Text.UTF8Encoding]::new($false)

If you use "Umlaute Ää Öö Üü" or "ß" then this line is Important.