Manager correlation rule not working

Hi all,

I have a manager “Manager correlation rule” as below:

import java.util.ArrayList;
  import java.util.Iterator;    
  import java.util.Map;    
  import java.util.HashMap;        
  import sailpoint.object.Filter;
  import sailpoint.object.QueryOptions;    
  import sailpoint.connector.Connector;
  import sailpoint.object.Application;
  import sailpoint.object.Identity;
  import sailpoint.object.Link;
  import sailpoint.object.ResourceObject; 
  import org.apache.commons.logging.Log;
  import org.apache.commons.logging.LogFactory;

  //private static Log log = LogFactory.getLog("ikano.rule.Axxxxxtion");

  log.debug("Entering xxxxxxCorrelation Rule");

  Map returnMap = new HashMap();
  String oprManagerAttribute = link.getAttribute("xxxxger");
  if(oprManagerAttribute!=null) {

    String xxxxame = oprManagerAttribute.split("- ")[1];
    Identity mgrId = context.getObjectByName(Identity.class, xxxxame );
    //returnMap.put("identityName", xxxxame );
    returnMap.put("identity", mgrId);
  }
  //return returnMap;
  return mgrId;
  log.debug("Ending xxxxxRule");

I dont see the manager field getting populated after the aggregation.

Am I missing something?

Thanks in advance

Hi @rishavghoshacc , everything looks fine, you’re just returning mgrId instead of the map (returnMap). Swap that last line to return returnMap; and it should populate.

@bohorapujan Tried that too. It was there and then I commented it out and tried with returning the identity itself. Did not work

The issue mgrId is declared inside the if block, but you return mgrId; outside it — that scope alone will throw a compile/runtime error, meaning the rule fails and no manager gets. and also other thingthis rule type expects you to return the manager’s identity name (String), not an Identity object or the returnMap.

Try below:

  1. Move the return inside the if block so it only returns when mgrId actually exists.
  2. Return xxxxame (the manager’s identity name string) instead of mgrId.
  3. Add an else (or fallback) to return null when the attribute is missing, so it doesn’t fall through undefined.

@rishavghoshacc does every account on that application actually have "- " in the manager attribute?

split("- ")[1] throws an ArrayIndexOutOfBoundsException on any value that doesn’t have that exact format or ending right after the dash. Accounts with no manager value at all are fine, those get skipped. But during Identity Refresh that exception can kill the whole refresh worker thread. One bad row out of a few thousand accounts is enough to make it look like the rule never works at all.

Guard it :

import java.util.HashMap;
import java.util.Map;

Map returnMap = new HashMap();

Object rawMgr = link.getAttribute("xxxxger");
if (rawMgr != null) {
    String[] parts = rawMgr.toString().split("- ", 2);
    if (parts.length > 1 && parts[1].trim().length() > 0) {
        returnMap.put("identityName", parts[1].trim());
    } else {
        log.error("MGRCORR: manager value not in expected format: [" + rawMgr + "]");
    }
} else {
    log.error("MGRCORR: manager attribute is null for link " + link.getNativeIdentity());
}

return returnMap;

Can you drop this in, rerun the Identity Refresh, and share what comes up? Specifically, check whether the MGRCORR log fires and what value you’re getting for the parsed manager. Also confirm that the parsed value actually matches the manager’s Identity name in IIQ. That should tell us pretty quickly whether the parsing/correlation is the problem or if we need to look somewhere else.

You can use this rule and add the attribute to the Identity Mapping (Manager attribute). Then perform an Identity Refresh and let me know. I created this rule based on the rule I already have.

the rule :

import java.util.Map;
import java.util.HashMap;
import sailpoint.object.Identity;
import sailpoint.object.Link;
import sailpoint.tools.Util;

String LOG_PREFIX = “ManagerCorrelationRule:::”;

Map returnMap = new HashMap();

try {

log.warn(LOG_PREFIX + "Rule started.");

String oprManagerAttribute = (link != null) ? link.getAttribute("xxxxger") : null;
log.warn(LOG_PREFIX + "oprManagerAttribute = [" + oprManagerAttribute + "]");

if (Util.isNullOrEmpty(oprManagerAttribute)) {
    log.warn(LOG_PREFIX + "Attribute is null/empty. Nothing to correlate.");
    return returnMap;
}

if (!oprManagerAttribute.contains("- ")) {
    log.warn(LOG_PREFIX + "Attribute [" + oprManagerAttribute +
             "] does not contain expected '- ' delimiter. Skipping.");
    return returnMap;
}

String[] parts = oprManagerAttribute.split("- ");
if (parts.length < 2 || Util.isNullOrEmpty(parts[1])) {
    log.warn(LOG_PREFIX + "Split produced no usable manager name from [" +
             oprManagerAttribute + "]. Skipping.");
    return returnMap;
}

String mgrName = parts[1].trim();
log.warn(LOG_PREFIX + "Extracted manager name = [" + mgrName + "]");

Identity mgrId = context.getObjectByName(Identity.class, mgrName);

if (mgrId == null) {
    log.warn(LOG_PREFIX + "No Identity found for manager name [" + mgrName + "]. Skipping.");
    return returnMap;
}

returnMap.put("identityName", mgrId.getName());
log.warn(LOG_PREFIX + "Manager resolved and assigned: [" + mgrId.getName() + "]");

return returnMap;

} catch (Throwable t) {
log.warn(LOG_PREFIX + "EXCEPTION: " + t.getMessage());
throw t;
} finally {
log.warn(LOG_PREFIX + “Rule finished. returnMap=” + returnMap);
}

Hello Rishav. I would check both the rule return and the Manager configuration.

In IIQ, a Manager Correlation rule should return a Map. Your returnMap.put("identity", mgrId) approach is valid, but returning mgrId directly is not. If the value after "- " is the manager’s IIQ Identity name, you can simplify the rule to:

Map returnMap = new HashMap();

Object rawMgr = link.getAttribute("xxxxger");
if (rawMgr != null) {
    String[] parts = rawMgr.toString().split("- ", 2);

    if (parts.length == 2 && parts[1].trim().length() > 0) {
        returnMap.put("identityAttributeName", "name");
        returnMap.put("identityAttributeValue", parts[1].trim());
    }
}

return returnMap;

Also verify:

  • Global Settings → Identity Mappings → Manager is configured correctly.
  • The parsed manager value exactly matches an existing Identity name.
  • After aggregation, run Identity Refresh with Refresh identity attributes and Refresh manager status enabled.

If you are testing the same unchanged manager data repeatedly, IIQ may skip manager correlation. In that case, test with alwaysRefreshManager=true.