Sync service return NULL from a powershell scrip

Hello all, 

I am using some powershell scripts to calculate the manager. The script returns the DN of the manager. 

If the script is able to calculate the manager, all works fine, but if the script cannot calculate (sometimes because it's not (yet) present) and will not return any value, the flow generates an error instead of just clearing the attribute. 

How can an attribute be cleared when there is no value availabled? (similar to %<attributename> when uring rules). 

Parents Reply
  • Unfortunately that doesn't work. 

    The PS is returning "System.Collections.Generic.List`1[System.Object]" and that's what the Sync Service will try to write to the attribute. 

    Below is my PS script, if I replace $null with "CN=DummyManager,OU=Test,DC=xxx,DC=xxx" it worrks fine. ExtensionAttribute4 hold the HR ID of the object.


    try
    {
       $Filter = "(extensionattribute4=$($($srcObj["AssignedManager"])))"
       $manager = (Get-QADuser -LdapFilter $filter ).DN
       if (($manager | Measure-Object).count -eq 1) {$manager} else {$null}
    }
    catch
    {
       $null
    }

Children