Filter query to get all identities with inactive managers

Hi all,

Can someone help with a query to find all identities with inactive managers?

This is for IIQ

Thanks in advance.

Are you looking for DB Query ?

@rishavghoshacc If you are looking for DB Query, then it is below:

SELECT i.name AS identity_name,
       m.name AS manager_name,
       m.inactive AS manager_status
FROM identityiq.spt_identity i
JOIN identityiq.spt_identity m ON i.manager = m.id
WHERE m.inactive = 1;
2 Likes

@msingh900 A DB query and also a filter query

@rishavghoshacc

  Filter filter = Filter.and(
    Filter.eq("manager.inactive", true),
    Filter.eq("inactive", false)
  );

  // Query matching identities
  QueryOptions qo = new QueryOptions();
  qo.addFilter(filter);

  Iterator it = context.search(Identity.class, qo);

  // Create a list to hold usernames
  List usernames = new ArrayList();

  // Iterate over identities and collect their names (usernames)
  while (it.hasNext()) {
    Identity id = (Identity) it.next();
    if (id != null) {
      usernames.add(id.getName()); 
    }
  }

  // Return the list of usernames
  return usernames;
2 Likes

@rishavghoshacc this is your code via Filter query.

Please mark it as solution, if this is what you are looking for,

2 Likes

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