IdentityAttribute rule issue

Hi Team,

I am trying to generate unique email from identity attribute with below patterns

  1. fi.ln
  2. fi.mi.ln
  3. fi.ln(uniquecounter)

I have this method below to check the unique email in the system however when i try validating the rule i am receiving the below error. Can you please help me on the same?

public boolean isUnique(String email){

log.debug("UoL_SAPEmailGenerator - Inside isUnique method");
	QueryOptions ops = new QueryOptions();
	int numberFound = 0;
	Filter filter = Filter.ignoreCase( Filter.eq("email", email));
	ops.addFilter(filter);
	try {
		numberFound = context.countObjects(Identity.class, ops);
		log.debug("UoL_SAPEmailGenerator - Printing numberFound:"+numberFound);
	} catch (GeneralException e) {
		// TODO Auto-generated catch block
	}
	return numberFound == 0;
}

How can I use this method differently so that I do not encounter this error?

HI @sindhu_v_murthy,

can you try

numberFound = (int)context.countObjects(Identity.class, ops);

If you are trying to find if an identity exists with the email, you can use countIdentitiesBySearchableIdentityAttribute method from sailpoint.server.IdnRuleUtil

https://developer.sailpoint.com/rule-java-docs/sailpoint/server/IdnRuleUtil.html

PS: I don’t think context is available in Identity Attribute Rule

Hi Both,

Thanks for supporting here yes context did not work i have used this method
countIdentitiesBySearchableIdentityAttribute and it worked fine for me.

Thanks a lot!

1 Like

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