Hi everyone,
I’m working on IdentityIQ version 8.4 and setting up correlation for Active Directory accounts. The idea is to create new identities using the username, first name, and last name.
The identities are getting created correctly, and correlation is working fine with the expected username. But for some reason, the first name and last name aren’t showing up in the identity object.
Here’s the part of the code I’m using:
String firstName = (String) i.getAttribute(“firstname”);
String lastName = (String) i.getAttribute(“lastname”);
identity.setFirstname(firstName);
identity.setLastname(lastName);
vedeepak
(Deepak Vema)
August 21, 2025, 3:53pm
2
Hi @Abhinav_Goel12
Were you able to see the values from below statements?
String firstName = (String) i.getAttribute(“firstname”);
String lastName = (String) i.getAttribute(“lastname”);
If you see the values, you need to save object and commit transactions after setting on Identity. Updated code below
identity.setFirstname(firstName);
identity.setLastname(lastName);
context.saveObject(identity);
context.commitTransaction();
context.decache();
tharshith
(Harshith Thondamnati)
August 22, 2025, 6:42am
3
Hi @Abhinav_Goel12
The issue might be because you’re not saving identity object. Add following lines at the end of your code
context.saveObject(identity);
context.commitTransaction();
Also you can verify the same if details are updated on identity or not by printing the identity object in logs.
Hello Harshith,
Thanks for the revert.
I am already saving the object using:
context.saveObject(identity);
context.commitTransaction();
tharshith
(Harshith Thondamnati)
August 22, 2025, 1:35pm
5
Are you able to print the updated Identity in logs ?
hello @Abhinav_Goel12 could you please share the complete code here?
Hello Santhi,
Below is the xml:
Identity creation rules are used to set attributes on new Identity objects when they are created. New identities may be created during the aggregation of application accounts, or optionally created after pass-through authentication.
if (account.getStringAttribute(“sAMAccountName”).toLowerCase().startsWith(“ch-adm”)) {
String manager = account.getStringAttribute(“manager”);
if (sailpoint.tools.Util.isNotNullOrEmpty(manager)) {
sailpoint.object.QueryOptions qo = new sailpoint.object.QueryOptions();
qo.addFilter(sailpoint.object.Filter.eq(“application.name”, “Active Directory”));
qo.addFilter(sailpoint.object.Filter.ignoreCase(sailpoint.object.Filter.eq(“nativeIdentity”, manager)));
java.util.Iterator itr = context.search(sailpoint.object.Identity.class, qo, “identity”);
if (itr.hasNext()) {
sailpoint.object.Identity i = (sailpoint.object.Identity) itr.next();
if (i != null) {
String firstName = (String) i.getAttribute("firstname");
String lastName = (String) i.getAttribute("lastname");
if (sailpoint.tools.Util.isNotNullOrEmpty(firstName) && sailpoint.tools.Util.isNotNullOrEmpty(lastName)) {
String formattedName = "(ADM) " + lastName+ ", " + firstName;
identity.setAttribute("firstname", firstName);
identity.setAttribute("lastname", lastName);
identity.setName(formattedName);
identity.setDisplayName(firstName);
try {
identity.setFirstname(firstName);
identity.setLastname(lastName);
} catch (NoSuchMethodError e) {
// Method not exist
}
} else {
identity.setName(i.getName());
}
identity.setModified(true);
identity.setType("administrator");
identity.setAdministrator(i);
context.startTransaction();
context.saveObject(identity);
context.commitTransaction();
}
}
sailpoint.tools.Util.flushIterator(itr);
}
}
Chathurya
(Chathurya Simhadri)
August 25, 2025, 11:02am
10
Hi @Abhinav_Goel12 ,
java.util.Iterator itr = context.search(sailpoint.object.Identity.class, qo, “identity”); // This returns an Iterator of an Array containing the properties mentioned in third parameter of search and ‘identity’ is also not a valid property for using in search.
As itr.next() returns an Iterator of an Array. so, you cannot retrieve the identity first name and lastname from i.
sailpoint.object.Identity i = (sailpoint.object.Identity) itr.next();
To get the iterator of an identity objects, you need to use:
java.util.Iterator itr = context.search(sailpoint.object.Identity.class, qo);
Sharad08
(Sharad Kumar)
August 25, 2025, 12:23pm
11
can you try with below line, instead of what you are using
java.util.Iterator itr = context.search(sailpoint.object.Identity.class, qo,);
Hello Sharad,
I have tried the approach suggested by you :
java.util.Iterator itr = context.search(sailpoint.object.Identity.class, qo);
but somehow it’s still not working. Below is the update code :
if (account.getStringAttribute(“sAMAccountName”).toLowerCase().startsWith(“ch-adm”)) {
String manager = account.getStringAttribute(“manager”);
if (sailpoint.tools.Util.isNotNullOrEmpty(manager)) {
sailpoint.object.QueryOptions qo = new sailpoint.object.QueryOptions();
qo.addFilter(sailpoint.object.Filter.eq(“application.name”, “Active Directory”));
qo.addFilter(sailpoint.object.Filter.ignoreCase(sailpoint.object.Filter.eq(“nativeIdentity”, manager)));
java.util.Iterator itr = context.search(sailpoint.object.Identity.class, qo);
if (itr.hasNext()) {
sailpoint.object.Identity i = (sailpoint.object.Identity) itr.next();
if (i != null) {
String firstName = (String) i.getAttribute("firstname");
String lastName = (String) i.getAttribute("lastname");
if (sailpoint.tools.Util.isNotNullOrEmpty(firstName) && sailpoint.tools.Util.isNotNullOrEmpty(lastName)) {
String formattedName = "(ADM) " + lastName+ ", " + firstName;
identity.setAttribute("firstname", firstName);
identity.setAttribute("lastname", lastName);
identity.setName(formattedName);
identity.setDisplayName(firstName);
try {
identity.setFirstname(firstName);
identity.setLastname(lastName);
} catch (NoSuchMethodError e) {
// Method not exist
}
} else {
identity.setName(i.getName());
}
identity.setModified(true);
identity.setType("administrator");
identity.setAdministrator(i);
context.startTransaction();
context.saveObject(identity);
context.commitTransaction();
}
}
sailpoint.tools.Util.flushIterator(itr);
}
}
Sharad08
(Sharad Kumar)
September 1, 2025, 9:00am
13
can you try adding log statement before and after and check if identity is object is getting updated in rule or not, and also if it is entering in if statements or not.
Hello Sharad,
I am able to resolve the issue by updating the query to search for link object instead :
context.search(sailpoint.object.Link.class, qo);Below is the updated code: String sAMAccountName = account.getStringAttribute(“sAMAccountName”);if (sAMAccountName != null && sAMAccountName.toLowerCase().startsWith(“ch-adm”)) {
String manager = account.getStringAttribute("manager");
if (sailpoint.tools.Util.isNotNullOrEmpty(manager)) {
sailpoint.object.QueryOptions qo = new sailpoint.object.QueryOptions();
qo.addFilter(sailpoint.object.Filter.eq("application.name", "Active Directory"));
qo.addFilter(sailpoint.object.Filter.ignoreCase(sailpoint.object.Filter.eq("nativeIdentity", manager)));
java.util.Iterator itr = context.search(sailpoint.object.Link.class, qo);
if (itr.hasNext()) {
sailpoint.object.Link link = (sailpoint.object.Link) itr.next();
sailpoint.object.Identity i = link.getIdentity();
if (i != null) {
String firstName = (String) i.getAttribute("firstname");
String lastName = (String) i.getAttribute("lastname");
if (sailpoint.tools.Util.isNotNullOrEmpty(firstName) && sailpoint.tools.Util.isNotNullOrEmpty(lastName)) {
String formattedName = "(ADM) " + lastName + ", " + firstName;
identity.setAttribute("firstname", firstName);
identity.setAttribute("lastname", lastName);
identity.setName(formattedName);
// identity.setDisplayName(firstName);
try {
identity.setFirstname(firstName);
identity.setLastname(lastName);
} catch (NoSuchMethodError e) {
}
} else {
identity.setName(i.getName());
}
identity.setType("administrator");
identity.setAdministrator(i);
context.startTransaction();
context.saveObject(identity);
context.commitTransaction();
}
}
sailpoint.tools.Util.flushIterator(itr);
}
}
But somehow this is working in Stg environment but not in production. Fname and Lname attributes are not getting updated.
system
(system)
Closed
November 7, 2025, 12:04pm
15
This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.