Sync Service workflow - $userCity = $srcObj["City"] Cannot index into a null array.

Hi Team,

We are facing issues to provision the users in the Active Directory Connector.

Our object is, based on the User City Location the sync workflow should be move the user to resective City.

We have created the OU structure as mentioned in the "https://support.oneidentity.com/technical-documents/active-roles/7.2/synchronization-service-administrator-guide/71#TOPIC-857217"

The below sample script we are using, but what we observed the script is not processing and returning Null array. Please help in fixing the issue.

$userCity = $srcObj["City"]
switch ($userCity)
{
"New York" {$container = "OU=New York,OU=Employees,DC=infoblox,DC=test"; break}
"Amsterdam" {$container = "OU=Amsterdam,OU=Employees,DC=infoblox,DC=test"; break}
"Tokyo" {$container = "OU=Tokyo,OU=Employees,DC=infoblox,DC=test"; break}
default {$container = "OU=OtherCities,OU=Employees,DC=infoblox,DC=test"; break}
}
$container

Getting below error, please help in fix the issue.

$userCity = $srcObj["City"]
Cannot index into a null array.
At line:1 char:1
+ $userCity = $srcObj["City"]
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : NullArray

Parents
  • The AD attribute is actually 'L'.  (yup, weird - stands for locality)

  • Thank you so much for your quick reply.

    $userCity = $srcObj["City"]
    switch ($userCity)
    {
    "New York" {$container = "OU=New York,OU=Employees,DC=infoblox,DC=test"; break}
    "Amsterdam" {$container = "OU=Amsterdam,OU=Employees,DC=infoblox,DC=test"; break}
    "Tokyo" {$container = "OU=Tokyo,OU=Employees,DC=infoblox,DC=test"; break}
    default {$container = "OU=OtherCities,OU=Employees,DC=infoblox,DC=test"; break}
    }
    $container
    .

    Sorry to say, the issue not resolved

    $userCity = $srcObj["L"]
     switch ($userCity)
    {
      "New York" {$container = "OU=New York,OU=Employees,DC=infoblox,DC=test"; break}
      "Amsterdam" {$container = "OU=Amsterdam,OU=Employees,DC=infoblox,DC=test"; break}
      "Tokyo" {$container = "OU=Tokyo,OU=Employees,DC=infoblox,DC=test"; break}
      default {$container = "OU=OtherCities,OU=Employees,DC=infoblox,DC=test"; break}
    }
    $container

    Is there any issue with this script, I am thinking City Attribute from CSV source file. in that we have City Attribute as "City" only, but in Active Directory we mapped it to "L". please suggest.

Reply
  • Thank you so much for your quick reply.

    $userCity = $srcObj["City"]
    switch ($userCity)
    {
    "New York" {$container = "OU=New York,OU=Employees,DC=infoblox,DC=test"; break}
    "Amsterdam" {$container = "OU=Amsterdam,OU=Employees,DC=infoblox,DC=test"; break}
    "Tokyo" {$container = "OU=Tokyo,OU=Employees,DC=infoblox,DC=test"; break}
    default {$container = "OU=OtherCities,OU=Employees,DC=infoblox,DC=test"; break}
    }
    $container
    .

    Sorry to say, the issue not resolved

    $userCity = $srcObj["L"]
     switch ($userCity)
    {
      "New York" {$container = "OU=New York,OU=Employees,DC=infoblox,DC=test"; break}
      "Amsterdam" {$container = "OU=Amsterdam,OU=Employees,DC=infoblox,DC=test"; break}
      "Tokyo" {$container = "OU=Tokyo,OU=Employees,DC=infoblox,DC=test"; break}
      default {$container = "OU=OtherCities,OU=Employees,DC=infoblox,DC=test"; break}
    }
    $container

    Is there any issue with this script, I am thinking City Attribute from CSV source file. in that we have City Attribute as "City" only, but in Active Directory we mapped it to "L". please suggest.

Children