Provision Attributes when change company attribute

Hello folks,

i have a problem where i need some help. We do have a company where there are different subcompanies. Each sub has different departments.

What i do want now is following:

i created a form where the first screen is the company and there is a second section with the department. If the company is changed i want that the departments (i do have an array of them for every company) is now populated as a dropdown.

I do have succesfully preprovisioned the attributes when nothing is changed. But when i change the company from A to B i still get the attributes populated of company A.

Which scriptpolicy is triggered when an attribute is changed? I think this is my problem which I do struggle with at the moment. OnGetEffectivePolicy is only called when i open the form initally. On Changing the Company from A to B nothing is done. Please help me :-)

Here are some codesnippets:


function onGetEffectivePolicy($Request)
{
if($Request.Class -ne "user"){return}

$test = $DirObj.GetInfo
#$Request >> C:\tmp\departmentchange.txt
$test >> C:\tmp\departmentchange.txt

$nachname = $DirObj.Get("sn")
$vorname = $DirObj.Get("givenName")
[void]($DirObj.GetInfoEx(@('edsvaAccountType'),0))
$VAValue = $DirObj.Get("edsvaAccountType")
$accounttype = $VAValue
$nachname >> C:\tmp\departmentchange.txt
$vorname >> C:\tmp\departmentchange.txt
$accounttype >> C:\tmp\departmentchange.txt
## Firmennamen setzen

if ($accounttype -ne $null){
switch ($accounttype){
"Extern" {
$externeFirmen = @("A", "B", "C")
$Request.SetEffectivePolicyInfo("company", $Constants.EDS_EPI_UI_POSSIBLE_VALUES, [string[]]$externeFirmen)
}
"Intern" {
$Companies = @("A","B","C")
$Request.SetEffectivePolicyInfo("company", $Constants.EDS_EPI_UI_POSSIBLE_VALUES, [string[]]$Companies)
}
default{
$Request.SetEffectivePolicyInfo("company", $Constants.EDS_EPI_UI_GENERATED_VALUE, "")
}
}
}

#"test1234" >> C:\tmp\departmentchange.txt
$abteilungen = @(Get-Content C:\Abteilungen\Immobilien.txt)
$Request.SetEffectivePolicyInfo("department", $Constants.EDS_EPI_UI_POSSIBLE_VALUES, [string[]]$abteilungen)
}

Parents
  • Hello, if you are possibly wanting to have the available Department dropdown list values changed the moment the Company is changed, then search the Active Roles SDK for 'Bound List Boxes'.

    To maybe answer the question about which function is triggered when an attribute is changed, the event handler onCheckPropertyValues could be used to analyze the changes before being saved to the object. You'll also find examples of this function in the SDK.

  • Hello Richard,

    thanks for the reply.

    I already checked that article about the "Bound List Boxes" but the problem is that the onGetEffective Policy only triggers when i open the edit form, not when changing the section from company to department.

    Is there any trigger which i can use when i change a value of a specific attribute not after clicking save. It should work when i change the value in the dropdown within the form.

    Best regards,

    Michael

Reply
  • Hello Richard,

    thanks for the reply.

    I already checked that article about the "Bound List Boxes" but the problem is that the onGetEffective Policy only triggers when i open the edit form, not when changing the section from company to department.

    Is there any trigger which i can use when i change a value of a specific attribute not after clicking save. It should work when i change the value in the dropdown within the form.

    Best regards,

    Michael

Children
No Data