Connector class availability in rule

Which IIQ version are you inquiring about?

8.4.p2

Hi Everyone,

I am trying to gather more data from integrated application but that operation requires custom code.

The question is the following:
Have you ever encountered an issue where the connector class was not available despite having required imports? (Causing typed variable declaration class not found in namespace error)
How did you solve it?
We noticed that the same piece of code with same imports is working when run from Before provisioning rule, but not from customization rule.

Any ideas?

@blazejbadzio Connector object might not be available as available argument but you should be able to load. could you please share your rule to review to see if anything missed over there?

Sure. That code is actually sufficient to cause an error.

<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE Rule PUBLIC "sailpoint.dtd" "sailpoint.dtd">
<Rule language="beanshell" name="TEST_Customization_Rule" type="ResourceObjectCustomization">
  <Description>This rule is configured on the application and is called after the connector has build a ResourceObject from the native application data.

Initially designed for non-rule based connectors to add SPPrivileged flag to an object, but could be used to do any transformations.</Description>
  <Signature returnType="ResourceObject">
    <Inputs>
      <Argument name="log" type="org.apache.commons.logging.Log">
        <Description>
          The log object associated with the SailPointContext.
        </Description>
      </Argument>
      <Argument name="context" type="sailpoint.api.SailPointContext">
        <Description>
          A sailpoint.api.SailPointContext object that can be used to query the database if necessary.
        </Description>
      </Argument>
      <Argument name="object">
        <Description>
          The ResourceObject built by the connector.
        </Description>
      </Argument>
      <Argument name="application">
        <Description>
          Application that references the connector.
        </Description>
      </Argument>
      <Argument name="connector">
        <Description>
          The connector object.
        </Description>
      </Argument>
      <Argument name="state">
        <Description>
          A Map containing state information.
        </Description>
      </Argument>
    </Inputs>
    <Returns>
      <Argument name="resourceObject">
        <Description>
          The updated resource object.
        </Description>
      </Argument>
    </Returns>
  </Signature>
  <Source>
  import sailpoint.object.Application;
  import sailpoint.connector.successfactors.*;
  import sailpoint.connector.SuccessFactorsConnector;
  import sailpoint.connector.successfactors.odata.SuccessFactorsRestAuthProvider;
  
   Application sfApp = context.getObjectByName(Application.class, "appName");
   sailpoint.connector.SuccessFactorsConnector successFactorsConnector = new sailpoint.connector.SuccessFactorsConnector(application);
   return object;
  </Source>
</Rule>

The code won’t work past the declaration of successFactorsConnector variable.
With error:

Exception running rule: BeanShell script error: bsh.EvalError: Sourced file: inline evaluation of: ``import sailpoint.object.Application;   import sailpoint.connector.successfactors . . . '' : Typed variable declaration : Class: sailpoint.connector.SuccessFactorsConnector not found in namespace : at Line: 7 : in file: inline evaluation of: ``import sailpoint.object.Application;   import sailpoint.connector.successfactors . . . '' : sailpoint .connector .SuccessFactorsConnector 
 BSF info: TEST_Customization_Rule at line: 0 column: columnNo

Let’s continue in chat.

Hi @blazejbadzio,

This is due to the way class loading works for IIQ. You see can this document for more info :slight_smile: IdentityIQ Connector-classloader FAQ - Compass

TLDR - to instantiate a connector you should use the ConnectorFactory

Application application = context.getObjectByName(Application.class, "appName");
Connector connector = ConnectorFactory.getConnector(application, null);