ISC BeforeProvisioning Rule Error calling getIdentityFromIdOrName

Given the following code in a BeforeProvisioningRule:

IdentityService is = new IdentityService(context);
Identity identityObject = is.getIdentityFromIdOrName(“”, nativeIdentity);

We get the following error:

["RuleExecutionException (ruleName\u003dGitHubBeforeProvision): BSFException: BeanShell script error: Sourced file: inline evaluation of: `` import sailpoint.object.ProvisioningPlan; import sailpoint.object.Prov . . . \u0027\u0027 : Typed variable declaration : Error in method invocation: Method getIdentityFromIdOrName( java.lang.String, java.lang.String ) not found in class\u0027sailpoint.api.IdentityService\u0027 : at Line: 25 : in file: inline evaluation of: `` import sailpoint.object.ProvisioningPlan; import sailpoint.object.Prov . . . \u0027\u0027 : is .getIdentityFromIdOrName ( \"\" , nativeIdentity ) \n BSF info: GitHubBeforeProvision at line: 0 column: columnNo, caused by org.apache.bsf.BSFException: BeanShell script error: Sourced file: inline evaluation of: `` import sailpoint.object.ProvisioningPlan; import sailpoint.object.Prov . . . \u0027\u0027 : Typed variable declaration : Error in method invocation: Method getIdentityFromIdOrName( java.lang.S... 0 column: columnNo"]

I read that as the getIdentityFromIdOrName() function does not exist in our environment when called with 2 String arguments. Yet, when we run it through the rule validator, it comes out clean.

Any idea with what is wrong? This is in our Dev tenant.

Thanks!

Steve

Try replacing the getIdentityFromIdOrName with the method getIdentityById.

For reference, verify the link and the image:

To get a identity, is there any particular use case for using getIdentityFromIdOrName.

This method is not supported in ISC.

Try using,

if (plan!=null) {
    List accountRequests = plan.getAccountRequests();

    if (accountRequests!=null) {
        for (AccountRequest accountRequest : accountRequests) {
            AccountRequest.Operation op = accountRequest.getOperation();

            // This is the first way of retrieving an identity
            Identity identity = plan.getIdentity();
            String nativeIdentity = accountRequest.getNativeIdentity();

            if(identity.getAttribute("firstname")!=null) {firstName = (String) identity.getAttribute("firstname");}

            // This is the optional way of retrieving an identity will be the continuation
            // Get internal ID on run
            String id = null;
            if (identity != null) {
                id = identity.getId();
            }

            // Fetch Identity object by internal ID
            Identity freshIdentity = null;
            if (internalId != null) {
                freshIdentity = idn.getIdentityById("id");
            }
            
            if (freshIdentity != null) {
                String email = freshIdentity.getEmail();
                log.info("Email: " + email);
            } else {
                log.warn("Identity not found for nativeIdentity: " + nativeIdentity);
            }

            // rest of the code
        }
    }
}
1 Like

Thank you for your response. I modified my code and will give it a try!

1 Like

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