C#

Joining objects in MIM when you have to calculate the matching attributes

Had a case this other day where we where unable to get a unique identifier from the different source systems, and all of these where to enter the same Windows AD.

The case

We have multiple countries with the same HR system each (Same system, but different databases). In all countries’ databases, the employee number stated on 10001. To solve this, we chose to prefix the employee number upon import. This isn’t a big deal, but it’s a bit more tricky when we need to make sure that a join is successful.

Solution

Not that tricky, but it takes time if you don’t know where to start, right?

As we have chosen to use Employee ID as the linked attribute, we decided to use this attribute for joining also. Why make it more complicated than we need to?

To begin, create a Management Agent Extension, and add the following Join rules there

void IMASynchronization.MapAttributesForJoin(string FlowRuleName, CSEntry csentry, ref ValueCollection values)
{
    switch (FlowRuleName)
    {
        case "JoinEmployeeID":
            if ((csentry["employeeID"] != null) || (csentry["employeeID"].StringValue != ""))
            {
                String emloyeeIdWithPrefix = "NO" + csentry["employeeID"].StringValue;
                values.Add(emloyeeIdWithPrefix);
            }
            else
            {
                throw new Exception(String.Format("EmployeeID can't be blank!"));
            }
            break;
        default:
            throw new EntryPointNotImplementedException();
    }
}

Then configure the following join rules on the Management Agent

Data Source Object Type Join Project Comment
Person Yes Yes
Mapping Group Action Metaverse Object Type Resolution
1 Join Person No
Data Source Attribute Mapping Type Metaverse Attribute Comment
employeeID Rules Extension – JoinEmployeeID employeeID See join extension rule
Use rules extension to resolve False

Thanks, and hope this could help someone else also 🙂

Advertisements