Skip to content
IT Canvass
Examples · Lesson

Java examples

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.search with 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 to learn this properly?

Our live, instructor-led SailPoint Training covers this hands-on, with real projects and a certification path.

Check your understanding

  1. What do Java examples use?

    • A. Inside IdentityIQ (rules, tasks, plugins).
    • B. The SailPointContext to query and modify objects.
    • C. With context.getObjectByName or getObjectById.
    Show answer

    B. The SailPointContext to query and modify objects.

    The SailPointContext to query and modify objects.

  2. How do you load an object?

    • A. Inside IdentityIQ (rules, tasks, plugins).
    • B. With context.getObjectByName or getObjectById.
    • C. The SailPointContext to query and modify objects.
    Show answer

    B. With context.getObjectByName or getObjectById.

    With context.getObjectByName or getObjectById.

  3. Where does this code run?

    • A. With context.getObjectByName or getObjectById.
    • B. The SailPointContext to query and modify objects.
    • C. Inside IdentityIQ (rules, tasks, plugins).
    Show answer

    C. Inside IdentityIQ (rules, tasks, plugins).

    Inside IdentityIQ (rules, tasks, plugins).

Frequently asked questions

What does the term Java examples refer to in SailPoint?

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.

What is another point to note about Java examples?

Use context.search with projection for large result sets. Decache in long loops to avoid memory build-up. Commit deliberately, only when you intend to persist.

What tends to go wrong with Java examples?

Loading full objects in large loops, exhausting memory. Forgetting null checks on getObjectByName. Uncommitted or over-committed changes.
CallWhatsAppEnquire