How can I pre-populate a dropdown with one of the possible values

I have a dropdown list with possible values on the Web UI and it works great, but I would like it to be pre-populated with value [0] in the array of possible values, so the user doesn't have to always select something if the default is needed.  I've tried the GENERATE_VALUE, the DEFAULT_VALUES, and some others, but I cannot get the Web UI to fill that field in on the form automatically and only if the user wants something different they can choose something else from the dropdown of that same field. Any ideas?

$domains = @("domain1.com","domain2.com")

$Request.SetEffectivePolicyInfo("edsva-Domain", $Constants.EDS_EPI_UI_POSSIBLE_VALUES, [string[]]$domains)
$Request.SetEffectivePolicyInfo("edsva-Domain", $Constants.EDS_EPI_UI_GENERATED_VALUE, [string[]]$domains[0])

  • Hi  

    Try something like the below:

    function onInit($context)
    {
        $context.UseLibraryScript("Script Modules/Library Scripts/OI - PoSh - Library Script")
    }
    
    function onGetEffectivePolicy($Request)
    {
        if($Request.class -ne "user") {return}
        
        $AttributeName = "adminDescription"
        $domains = @("domain1.com","domain2.com")
    
    
        SetEffectivePolicy -AttributeName $AttributeName `
                           -Request $Request `
                           -PossibleValues $Domains `
                           -GeneratedValue $Domains[0] `
                           -DisplayNote "$($AttributeName) values are generated from a list" `
                           -IsValueRequired $True
    }
    
    
    
    function onCheckPropertyValues($Request)
    {
    
        if($Request.class -ne "user") {return}
        
        $AttributeName = "adminDescription"
        $domains = @("domain1.com","domain2.com")
        $Message = [string]::Format("You must select only a value from this list`n{0}",$($Domains -join ";"))
        
        ValidateAndGenerateAttribute `
                         -AttributeName $AttributeName `
                         -Request $Request `
                         -IsValueRequired $true `
                         -PossibleValues $Domains `
                         -DisplayNote $Message
    }

    The Library Script I've referenced is from here: (2) PowerShell Library Source Code - Wiki - Active Roles Community - One Identity Community

    In my case I've scripted a container under script modules called "Library Scripts", and the script module I've pasted the script into is called "OI - PoSh - Library Script"

    Note, that for new users (created after the Administration Policy is applied) the default value and options will be set, and the drop down list populated

    For existing users, it won't as the policy didn't apply. However with the onCheckPropertyValues function (IE right clicking on an ou or object and clicking Check Policy), it will report the violation, and you have the ability to go and change it.