Examples · LessonReviewed by Imran Q, SailPoint Trainer, 7 yrs · Updated · Published · IdentityIQ 8.4 · all levels
SailPoint Java examples
Example Java using the IdentityIQ API/context.
Quick answer
These Java examples show using the SailPoint context to query objects programmatically inside IdentityIQ.
Key takeaways
- Using SailPointContext
- Querying objects
- Committing changes
- Run within IIQ or a plugin
Server-side Java in IdentityIQ uses the SailPointContext to read and write objects. These examples show the fundamental pattern used inside rules, tasks and plugins.
Load and read an identity
import sailpoint.object.Identity;
Identity id = context.getObjectByName(Identity.class, "jdoe");
if (id != null) {
String dept = id.getStringAttribute("department");
Identity mgr = id.getManager();
}Query with a filter
import sailpoint.object.*;
QueryOptions qo = new QueryOptions();
qo.addFilter(Filter.eq("department", "Finance"));
Iterator it = context.search(Identity.class, qo);Guidance
- Use
context.searchwith projection for large result sets. - Decache in long loops to avoid memory build-up.
- Commit deliberately, only when you intend to persist.
Common pitfalls
- Loading full objects in large loops, exhausting memory.
- Forgetting null checks on
getObjectByName. - Uncommitted or over-committed changes.
Want this with a live instructor and a lab tenant?