For each loop in correlation rule is not working

Hi Experts,

We are using below correlation rule but however the code is not able to execute the for each loop -->for(Object identity: identities). I tried typecasting to sailpoint.object.Identity, that is also not working. Could you please suggest what can be the root cause of this issue?

Correlation Rule:

import sailpoint.object.Identity;

	Map returnMap = new HashMap();
		Object emailObj =  account.getAttribute("userId");
		String email =  (emailObj != null ) ? (String) emailObj : null;
		log.error("Vistra WS Correlation - EmailID is: "+email);
		if(null != email)
		  List identities =  idn.findIdentitiesBySearchableIdentityAttribute("email", "Equals", email,"email");
			log.error("Vistra WS Correlation - List identities is: "+ identities);

		  if( identities != null && identities.size() > 0)
		  if(identities.size() == 1 )
			log.error("Correlation - List identities email : "+ email);
			returnMap.put( "identityAttributeName", "email");
			returnMap.put( "identityAttributeValue", email);
		  }else {
				log.error("Correlation : Identity List is greater than 1");
				log.error("Correlation : Identity Size is"+ identities.size());
				log.error("Correlation : Identity List 2 is "+ identities);
				for(Object identity: identities)
					log.error("Inside for loop "+ identity);
					Identity idenObject = (Identity) identity;
					log.error("Correlation : Inside For Loop"+ idenObject);
					log.error("Correlation : Identity Found is"+ identity);
					Object idnWorkdayFileNumberObj = idenObject.getAttribute("workdayFileNumber");
					log.error("Correlation : workdayFileNumber Found"+ idnWorkdayFileNumberObj);
					String idnWorkdayFileNumber = (null != idnWorkdayFileNumberObj) ? (String) idnWorkdayFileNumberObj : null;
					 log.error("Correlation - idnWorkdayFileNumber : "+ idnWorkdayFileNumber);
					 if ( null != idnWorkdayFileNumber)
						log.error("Correlation : Identity Found");
						String idnUID= idenObject.getAttribute("uid");
						returnMap.put("identityAttributeName", "uid");
						returnMap.put("identityAttributeValue", idnUID);
	}catch(Exception e){
		log.error("Exception : In correlation rule " + e.getMessage());
	return returnMap;

Hi @amajumdar1

Object emailObj = account.getAttribute("userId");
You are extracting userId from account, hope it has email only.

Code looks good. How are you able to say that, loop is not executing ?

This is a cloud Rule, by any chance did you get logs from SailPoint ?


Thanks @MVKR7T for responding.
account.getAttribute(“userId”) is giving email id.Attaching the logs that sailpoint shared.
In the logs you will notice that its not going inside the for each loop.

Here are the logs-
vistraenergy-sb-logs-221123 (1).json (26.2 KB)


What if you try the old fashioned for( int i = 0; i < list.length; i++).

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.