Hi,
We have several OUs and each OU can have one or more companies and Address information.
All this information is stored in a CSV, and when creating users, we provide a drop-down to choose from based on OU.
I wanted to provide a process to move users between different OU and in the process also information should be changed.
Since i can't automate things, my idea was to provide an OU drop-down where to move, and then based on the OU choice, address and company are shown.
For this i looked into the "Creating bound list-boxes" Example,
the code seems to work but somehow no possible values are shown for company
this is the debug output
DEBUG: ! SET $possibleValues = 'My Company'.
DEBUG: 433+ >>>> $Request.SetEffectivePolicyInfo($AttrMoveCompany, $Constants.EDS_EPI_UI_POSSIBLE_VALUES, [string[]]$possibleValues)
Call method '$Request.SetEffectivePolicyInfo'
Arguments list:
[1] : Value=edsvaUserNamedMoveCompany : Type=System.String
[2] : Value=3 : Type=System.Int32
[3] : Value=System.String[] : Type=System.String[] : IsMultivalued=True : Count=1
[0] : Value=My Company : Type=System.String
Call '$Request.get_EffectivePolicyInformation'
Call '$Request.get_EffectivePolicyInformation'
DEBUG: 435+ >>>> }
that my code example
function GetCurrentValue($Request, [string]$AttributeName)
{
trap { continue }
$value = $Request.Get($AttributeName)
if ($value -eq $null)
{
$DirObj.GetInfoEx(@($AttributeName), 0) | Out-Null
$value = $DirObj.Get($AttributeName)
}
$value
}
function onGetEffectivePolicy($Request)
{
######### Control #########
$Formname = "MoveOU"
# Exit function if request is not for a user
if ($Request.Class -ne 'user') { return }
# Catch GetInControl NULL
try
{
$Form = $Request.GetInControl("Form")
}
catch
{
return
}
if ($Form -eq $Formname)
{
$AttrMoveOU = "edsvaUserNamedMoveOU"
$AttrMoveCompany = "edsvaUserNamedMoveCompany"
$CSVImport = Import-Csv -delimiter ";" -Encoding default -Path "E:\One Identity\CSV\Company.csv"
$OUs = $CSVImport.OU | select -uniq
$possibleValues = @()
$Request.SetEffectivePolicyInfo($AttrMoveCompany, $Constants.EDS_EPI_UI_RELOAD_EPI_BY_RULE, $AttrMoveOU)
$Request.SetEffectivePolicyInfo($AttrMoveOU, $Constants.EDS_EPI_UI_RESTRICTED, $TRUE)
$Request.SetEffectivePolicyInfo($AttrMoveOU, $Constants.EDS_EPI_UI_POSSIBLE_VALUES, [string[]]$OUs)
$Request.SetEffectivePolicyInfo($AttrMoveOU, $constants.EDS_EPI_UI_AUTO_GENERATED, $true)
$CurrentOU = GetCurrentValue -Request $Request -AttributeName $AttrMoveOU
$possibleValues = $CSVImport | Where-Object { $CurrentOU -like $_.OU } | Select-Object Company -ExpandProperty Company -uniq
$Request.SetEffectivePolicyInfo($AttrMoveCompany, $Constants.EDS_EPI_UI_POSSIBLE_VALUES, [string[]]$possibleValues)
}
}