Hi All,
I was trying to fetch the the list of user from the department bases tried to write the code. getting the error for the below code.
import sailpoint.object.Application;
import sailpoint.object.Filter;
import sailpoint.object.Identity;
import sailpoint.object.List;
//Identity user = context.getObjectByName(Identity.class, identity);
String dept =“Finance”;
Filter f = Filter.eq(“department”, dept);
List list = context.getObjectByName(Identity.class, f);
return list;
//return user;
Thanks.
shirbhatea
(Ankush Shirbhate)
November 26, 2025, 8:56am
2
I hope department attribute is searchable for the identity. Try the below example.
import sailpoint.object.Filter;
import sailpoint.object.Identity;
import sailpoint.object.List;
import sailpoint.object.QueryOptions;
String dept ="Finance";
QueryOptions qo = new QueryOptions();
qo.addFilter(Filter.eq("department", dept)
List list = context.getObjects(Identity.class, qo );
return list;
Regards
Ankush
Hi @shirbhatea ,
Tried with this code, but still getting below error msg.
Exception running rule: BeanShell script error: bsh.EvalError: Sourced file: inline evaluation of: //import sailpoint.object.Application; //import sailpoint.object.Filter; // i . . . '' Token Parsing Error: Lexical error at line 24, column 14. Encountered: "\u201c" (8220), after : "" : at Line: 22 : in file: inline evaluation of: //import sailpoint.object.Application; //import sailpoint.object.Filter; // i . . . ‘’ : import sailpoint .object .QueryOptions ;
BSF info: Test Rule at line: 0 column: columnNo
shirbhatea
(Ankush Shirbhate)
November 26, 2025, 10:11am
4
replace the double quote for “Finance”. Try now, i have updated the sample code.
Chathuryas
(Chathurya Simhadri)
November 26, 2025, 1:43pm
5
Hi , use the code below to get the users in finance department and make sure the attribute name is correct and searchable in IdentityMappings.
import sailpoint.object.Filter;
import sailpoint.object.QueryOptions;
import sailpoint.object.Identity;
import java.util.Iterator;
import java.util.List;
import java.util.ArrayList;
import sailpoint.tools.Util;
String department = "Finance";
List identities = new ArrayList();
QueryOptions qo = new QueryOptions();
qo.addFilter(Filter.ignoreCase(Filter.eq("department",department)));
Iterator iterator = context.search(Identity.class,qo,"name");
while(iterator!=null && iterator.hasNext()){
Object[] userNames = (Object[]) iterator.next();
identities.add((String) userNames[0]);
}
Util.flushIterator(iterator);
return identities;
you can find this methods in the url : http://domainname/identityiq/doc/javadoc