Comparing multiple CS entries in rules extensions

I've created a lab scenario where I have many CS entries to one MV person. Each CS record has a date range specifying whether the information in that record is current, and a job role. Certain job roles out rank other job roles.  So a user may have three job roles: Cleaner, Designer and Manager. Manager outranks Designer, Designer outranks Cleaner. 

If I create a user with one record showing them as a Manager and another record showing them as a Cleaner, both with valid dates how can I make it so that the Manager record outranks their Cleaner status, yet if their Manager record expires first, the Cleaner status takes precedence?

I know that to achieve this I could import additional information into the MV or portal, or I could handle the information prior to presenting it to FIM but I am curious to know whether it is possible entirely in rules extensions.

In pseudo code, my process was:

Are CS attributes present?  
    Is the date range current?
        Is the start date newer than the existing start date?
            Does the CS-jobrole outrank MV-jobrole?

But then I realised if a user has previously been a Manager but is no longer, the job role will remain Manager as this outranks the jobrole CS entry.

Any suggestions? Am I missing something? Thanks.

February 4th, 2015 11:19am

Hi,

One way to do what you want would be to have a rules extension connector filter that filters out any employments that are not longer active. Then you can loop all Active (and joined) employments in your rules extension. This would be a huge overhead though on the sync service, because you would need to make this calculation for each attribute flow into MV to be sure that you grab cs info from the correct object all the time.

It would also be a problem if a person would have 2 or more employments with the same title etc. So this code is not tested but should get you started in the right direction. Needless to say it wouldn't be the optimal solution but might work......
Personally I would try to filter out and sort the employments in the source system instead so you get the correct data in. Most datbases like SQL, Oracle DB2 etc supports partitioning of the data in i view etc so you can filter out and make sure you end up with only one entry.
Anyway, here it goes....

Filter code:

bool IMASynchronization.FilterForDisconnection(CSEntry csentry)
        {
            //
            // Filter code
            //
            #region Filter code
            bool returnValue = false;

            // We check the employeeEndDate to be able to filter out old employments.
            if (csentry["endDate"].IsPresent)
            {
                DateTime endDate = DateTime.ParseExact(csentry["endDate"].Value.Trim(), "yyyy-MM-dd", CultureInfo.InvariantCulture);
                if (endDate < DateTime.Now)
                 return true;
               
            }       

            return returnValue;

            #endregion
        }

 

The import attribute flow code:

if (csentry["JobTitle"].IsPresent)
                    {                       
                        foreach (ConnectedMA ConnectedManagementAgent in mventry.ConnectedMAs)
                        {
                            // We only accumulate values from connectors in the HRsystem CS.
                            if (ConnectedManagementAgent.Name == MA_NAME)
                            {
                                // We identify the CS attributes to fetch.
                                string csAttr1 = "JobTitle";
                                string csAttr2 = "employmentType"; // Change this to the attribute you want to flow in
                                string rankedTitle = null;

                                foreach (CSEntry ConnectorSpaceEntry in ConnectedManagementAgent.Connectors)
                                {
                                    // Iterate over all employments and grab the values from the highest ranked employment.
                                    rankedTitle = ConnectorSpaceEntry[csAttr1].Value;

                                    if (rankedTitle == "Manager")
                                    {
                                        // We hit the highest rank. We flow in the employmenttype info for this employment to MV
                                        mventry["employmentType"].Value = ConnectorSpaceEntry[csAttr2].Value;
                                        break;
                                    }
                                   
                                    // Code to evaluate the other csentries and to get the highest ranking title and it's value....

                                }
                                // End foreach csentry
                            }
                        }
                       
                    }

  • Marked as answer by FIM-EN 4 hours 1 minutes ago
Free Windows Admin Tool Kit Click here and download it now
February 5th, 2015 6:03pm

Hi,

One way to do what you want would be to have a rules extension connector filter that filters out any employments that are not longer active. Then you can loop all Active (and joined) employments in your rules extension. This would be a huge overhead though on the sync service, because you would need to make this calculation for each attribute flow into MV to be sure that you grab cs info from the correct object all the time.

It would also be a problem if a person would have 2 or more employments with the same title etc. So this code is not tested but should get you started in the right direction. Needless to say it wouldn't be the optimal solution but might work......
Personally I would try to filter out and sort the employments in the source system instead so you get the correct data in. Most datbases like SQL, Oracle DB2 etc supports partitioning of the data in i view etc so you can filter out and make sure you end up with only one entry.
Anyway, here it goes....

Filter code:

bool IMASynchronization.FilterForDisconnection(CSEntry csentry)
        {
            //
            // Filter code
            //
            #region Filter code
            bool returnValue = false;

            // We check the employeeEndDate to be able to filter out old employments.
            if (csentry["endDate"].IsPresent)
            {
                DateTime endDate = DateTime.ParseExact(csentry["endDate"].Value.Trim(), "yyyy-MM-dd", CultureInfo.InvariantCulture);
                if (endDate < DateTime.Now)
                 return true;
               
            }       

            return returnValue;

            #endregion
        }

 

The import attribute flow code:

if (csentry["JobTitle"].IsPresent)
                    {                       
                        foreach (ConnectedMA ConnectedManagementAgent in mventry.ConnectedMAs)
                        {
                            // We only accumulate values from connectors in the HRsystem CS.
                            if (ConnectedManagementAgent.Name == MA_NAME)
                            {
                                // We identify the CS attributes to fetch.
                                string csAttr1 = "JobTitle";
                                string csAttr2 = "employmentType"; // Change this to the attribute you want to flow in
                                string rankedTitle = null;

                                foreach (CSEntry ConnectorSpaceEntry in ConnectedManagementAgent.Connectors)
                                {
                                    // Iterate over all employments and grab the values from the highest ranked employment.
                                    rankedTitle = ConnectorSpaceEntry[csAttr1].Value;

                                    if (rankedTitle == "Manager")
                                    {
                                        // We hit the highest rank. We flow in the employmenttype info for this employment to MV
                                        mventry["employmentType"].Value = ConnectorSpaceEntry[csAttr2].Value;
                                        break;
                                    }
                                   
                                    // Code to evaluate the other csentries and to get the highest ranking title and it's value....

                                }
                                // End foreach csentry
                            }
                        }
                       
                    }

  • Marked as answer by FIM-EN Friday, February 06, 2015 7:43 AM
February 6th, 2015 1:59am

Hi,

One way to do what you want would be to have a rules extension connector filter that filters out any employments that are not longer active. Then you can loop all Active (and joined) employments in your rules extension. This would be a huge overhead though on the sync service, because you would need to make this calculation for each attribute flow into MV to be sure that you grab cs info from the correct object all the time.

It would also be a problem if a person would have 2 or more employments with the same title etc. So this code is not tested but should get you started in the right direction. Needless to say it wouldn't be the optimal solution but might work......
Personally I would try to filter out and sort the employments in the source system instead so you get the correct data in. Most datbases like SQL, Oracle DB2 etc supports partitioning of the data in i view etc so you can filter out and make sure you end up with only one entry.
Anyway, here it goes....

Filter code:

bool IMASynchronization.FilterForDisconnection(CSEntry csentry)
        {
            //
            // Filter code
            //
            #region Filter code
            bool returnValue = false;

            // We check the employeeEndDate to be able to filter out old employments.
            if (csentry["endDate"].IsPresent)
            {
                DateTime endDate = DateTime.ParseExact(csentry["endDate"].Value.Trim(), "yyyy-MM-dd", CultureInfo.InvariantCulture);
                if (endDate < DateTime.Now)
                 return true;
               
            }       

            return returnValue;

            #endregion
        }

 

The import attribute flow code:

if (csentry["JobTitle"].IsPresent)
                    {                       
                        foreach (ConnectedMA ConnectedManagementAgent in mventry.ConnectedMAs)
                        {
                            // We only accumulate values from connectors in the HRsystem CS.
                            if (ConnectedManagementAgent.Name == MA_NAME)
                            {
                                // We identify the CS attributes to fetch.
                                string csAttr1 = "JobTitle";
                                string csAttr2 = "employmentType"; // Change this to the attribute you want to flow in
                                string rankedTitle = null;

                                foreach (CSEntry ConnectorSpaceEntry in ConnectedManagementAgent.Connectors)
                                {
                                    // Iterate over all employments and grab the values from the highest ranked employment.
                                    rankedTitle = ConnectorSpaceEntry[csAttr1].Value;

                                    if (rankedTitle == "Manager")
                                    {
                                        // We hit the highest rank. We flow in the employmenttype info for this employment to MV
                                        mventry["employmentType"].Value = ConnectorSpaceEntry[csAttr2].Value;
                                        break;
                                    }
                                   
                                    // Code to evaluate the other csentries and to get the highest ranking title and it's value....

                                }
                                // End foreach csentry
                            }
                        }
                       
                    }

  • Marked as answer by FIM-EN Friday, February 06, 2015 7:43 AM
Free Windows Admin Tool Kit Click here and download it now
February 6th, 2015 1:59am

Hi Patrick,

Thanks so much for your detailed response. It makes a lot of sense.

I realise this wasn't the best example and I would always manipulate the source as much as possible to get it right before passing to FIM but your answer has really explained what I was getting at.

Thanks!

February 6th, 2015 2:48am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics