Error in method invocation: Method getApplication(java.lang.String) not found in class'sailpoint.object.Identity' at Line: 53 : in file: inline evaluation of: ``import sailpoint.object.*; import sailpoint.object.Attributes;

Why I am getting this error with the following code

Exception running rule: BeanShell script error: bsh.EvalError: Sourced file: inline evaluation of: import sailpoint.object.*; import sailpoint.object.Attributes; import sailpo . . . '' : Error in method invocation: Method getApplication(java.lang.String) not found in class'sailpoint.object.Identity' : at Line: 53 : in file: inline evaluation of: import sailpoint.object.*; import sailpoint.object.Attributes; import sailpo . . . ‘’ :

  QueryOptions qo = new QueryOptions();

// Adding filters to the QueryOptions
  
qo.addFilter(Filter.and(
    Filter.eq("links.application.name", "Active Directory"), 
    Filter.eq("links.disabledAccount", "false")
));
  
qo.addFilter(Filter.eq("orgStatus", "Hired"));

List userList = new ArrayList();

// Searching for identities based on the query options
Iterator it = context.search(Identity.class, qo);

while (it.hasNext()) {
    Identity identity = it.next();

    // Check if the identity does not have the "HR" application
  
    if (identity.getApplication("HR") == null) {
        userList.add(identity.getAttribute("staffId"));
    }
}

// Returning the list of user staff IDs
return userList;



Thank you

hey ,

On the iterator , you ahve to Cast the object before grabbing the next()

Also the properties cannot extend that deep. If you want to search on the links, use the Link object. Or Use a Join Operation.

best1

Issue is actually here identity.getApplication("HR") simply speaking Identity does not have an Application reference - you have to get links from the identity via identity.getLinks() and then iterate over the list of links the identity has.

There is deprecated method identity.getLink(appName) but well its deprecated.

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